by ehmmm · 11y ago · 0 comments
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]It does however specify that [] operator is equivalent to pointer arithmetic. But we are talking ->,. operators and not [].