|
|
|
|
|
by Maro
3463 days ago
|
|
I haven't written C in a while, but I think this is pretty stupid. sizeof() is a compile-time thing in C, so it's substituted with a number by the time you get an executable. See: http://stackoverflow.com/questions/671790/how-does-sizeofarr... I think this is effectively doing the same thing, but in a non-standard way; ie. I think `int n = (&arr)[1] - arr;` is substituted with the actual the number by the compiler the same way sizeof() would be, only noone will know wtf is going on. Disclaimer: I didn't look at the generated code to confirm; I guess it could even be compiler/runtime dependent. |
|