gcc bites
Just save it to a file, gcc file.c, ./a.out and ...
No, gcc is not wonderful. I do believe that this code is valid C, and that it should work. Yes, it could be worked around for any given size of array in the kernel, but I guess gcc should just know what it is compiling for and throw compilation error -- or work around the problem using malloc/free internally.
And yes, I have seen the same problem bite unexpectedly in real life. When combined with variable-length-array gcc extension, it is quite deadly.
#include <stdio.h> int main(int argc, char *argv[]) { char a[9000000]; printf("gcc is wonderful\n"); }
No, gcc is not wonderful. I do believe that this code is valid C, and that it should work. Yes, it could be worked around for any given size of array in the kernel, but I guess gcc should just know what it is compiling for and throw compilation error -- or work around the problem using malloc/free internally.
And yes, I have seen the same problem bite unexpectedly in real life. When combined with variable-length-array gcc extension, it is quite deadly.