by ploxiln · 11y ago · 0 comments
That becomes a problem with modern optimizing compilers, because they make assumptions about your code based on what's allowed according to the spec.
struct usb_line6 *line6 = &podhd->line6;
Offset is calculated "below the hood". Pointer arithmetic is defined with arithmetic operands: +,--> and . are not arithmetic operands.
If you look at the definition of the -> and [], you might learn something!
[] operator doesn't have any place in this debate.
What @jwatte tried to say is that `->` works like this:
// foo is struct thingity*
&foo->bar == foo + offsetof(struct thingity, bar);
The `[]` does a similar thing: // s is char*
*(s+i) == s[i]