M
mike.polyakov
Hi Everyone,
I've just come across an expression that I always thought should not
compile:
int j = 0;
int b[j];
But it compiles fine under gcc4.3.4. Obviously it is not very useful,
but what does it mean? No memory can be allocated at compile time, but
b seems to act like a pointer. I've browsed through the standard and
found nothing that would indicate that this is legal. The section on
declarations of arrays (8.3.4) says that only constant expressions are
allowed in brackets. Can anyone please explain this to me?
Thank you.
-Mike
I've just come across an expression that I always thought should not
compile:
int j = 0;
int b[j];
But it compiles fine under gcc4.3.4. Obviously it is not very useful,
but what does it mean? No memory can be allocated at compile time, but
b seems to act like a pointer. I've browsed through the standard and
found nothing that would indicate that this is legal. The section on
declarations of arrays (8.3.4) says that only constant expressions are
allowed in brackets. Can anyone please explain this to me?
Thank you.
-Mike