Re:Porting to GCC 14: C language issues
by LegionMammal978 on Tuesday February 20, 2024 @11:09AM
(#39442998)
Yet
void f(size_t n, int cond) {
if (cond) { n += 1; }
int x[n];
...
does resize x depending on the value of cond, so the size can't necessarily be known until the point where the type (int[n] in this case) is named.Also, the compiler has to make sure it keeps around implicit locals to store the variable layouts, so that code like
void f(size_t n) {
typedef int array[n];
n += 1;
array x;
...
functions as specified. This kind of pattern is one of the bigger things setting the feature apart from just "syntax sugar for alloca()".
Well, is it much more machinery? IIRC doing
does not resize x, so there is no dataflow dependency or rather, x depends on a hidden const variable so no additional dataflow analysis necessary.