Lurker News
Back to discussion

Comment by quelsolaar

quelsolaar1 reply#
they are accessed using pointer arithmetic, if you wanted them to contain length data, you would need a different access pattern. I think one of the great features of C is that it doesn't do anything under the hood, its all explicit. If you want to bounds check, then do it.
WalterBright2 replies#
> they are accessed using pointer arithmetic

Not always. Consider:

    int a[3];
    a[1] = 2;
This is not using pointer arithmetic. Dump the generated code if you don't believe me :-)
quelsolaar#
Its still pointer arithmetic, its just done compile time rather then at execution. Still, you deserve style points :-)
saagarjha#
Tell that to

  mov DWORD PTR [rsp - 8], 2