|
|
|
|
|
by actionfromafar
856 days ago
|
|
Snarky or just know a lot? It changes quite a bit how the compiler works. It has to know to make sure malloc gets the array element size argument multiplied in runtime by n. To a mere user it broke my mental shorthand of how a C compiler works. |
|
Um, C compilers already do that with arrays with compile-time lengths.
prints so you can have "char *y = malloc(sizeof(x)); memcpy(y, x, sizeof(x));" and it must work since C89 at least. The main problem with VLAs is that they make exact the stack frame size unknown until runtime which complicates function prologues/epilogues but that's the problem in the codegen part of the backend, the semantics machinery is mostly in the place already.P.S. And yes, uecker is a member of the ISO C WG14 and GCC contributor, according to his profile.