Keith Thompson <kst-> writes:
> Barry Schwarz <> writes:
>> On Mon, 27 Aug 2012 13:35:35 -0700 (PDT), wrote:
> [snip]
>
>>>The i term added to a is being added to the base address of the array
>>>and itself, i, representing the size of a row. j then adds to that
>>>address giving the column position.
>>
>> When a pointer and an integer are added, the value of the integer is
>> scaled by the size of the object pointed to, or if you prefer, the
>> size of the object type pointed to.
>
> Another way to look at it is that the value is *not* "scaled" by the
> size of the object pointed to; rather, the addition yields a pointer
> that points N *objects* past the object that the original pointer
> points to. (There has to be an array for this to make sense, possibly
> the 1-element array that's equivalent to a single object.)
>
> The standard's description doesn't talk about scaling (N1570 6.5.6p
:
> [snip quoted paragraph]
But, talking about the [] array indexing operator, the Standard
does say in a footnote
Then i is adjusted according to the type of x, which
conceptually entails multiplying i by the size of the
object to which the pointer points
I'm not arguing for or against either explanation; I think both
have some support (as an explanation) in the Standard.