Reasons For Non-unit Stride
There are at least two reasons arrays may have a stride larger than their elements' width in bytes. First, many languages (including C and C++) allow structures to be padded to better take advantage of the word length of the machine. For example:
struct ThreeBytesWide { char a; }; struct ThreeBytesWide myArray;In the above code snippet, myArray might well turn out to have a stride of four bytes, rather than three, if the C code were compiled for a 32-bit architecture, and the compiler had optimized (as is usually the case) for minimum processing time rather than minimum memory usage.
Second, some languages allow arrays of structures to be treated as overlapping parallel arrays with non-unit stride:
#includeThis idiom is a form of type punning.
Read more about this topic: Stride Of An Array
Famous quotes containing the words reasons for, reasons and/or stride:
“I should like to know what is the proper function of women, if it is not to make reasons for husbands to stay at home, and still stronger reasons for bachelors to go out.”
—George Eliot [Mary Ann (or Marian)
“Write to the point: say immediately what you want to say most, even if it doesnt come first. There are three reasons for doing this. First, you will then have said it, even if nothing else gets said. Second, your readers will then have read it, even if they read no more. Third, having said it, you are likely to have to say something more, because you will have to explain and justify what you chose to say.”
—Bill Stott (b. 1940)
“I, in my intricate image, stride on two levels....”
—Dylan Thomas (19141953)