https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896
--- Comment #32 from Martin Uecker <muecker at gwdg dot de> --- Am Mittwoch, dem 08.03.2023 um 19:20 +0000 schrieb qinzhao at gcc dot gnu.org: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896 > > --- Comment #30 from qinzhao at gcc dot gnu.org --- > (In reply to Martin Uecker from comment #28) > > > The problems with VLA are in my opinion caused by poor > > implementation (e.g. no stack probing etc) and bad > > code generation (Linus was not happy about this) and > > not because anything is fundamentally bad about them > > from the point of language semantics. > > you mean gcc's implementation? how about other compilers? I mostly mean compilers without stack probing (which GCC has but is not activated by default). Code quality is probably still bad for most compilers. > > > VM = variably modified. In C it is a type which is derived from > > a VLA which is not necessarily itself a VLA, e.g. a pointer to > > a VLA. But a VLA is also a VM type. > > Okay. > > > > > struct foo { > > > int len; > > > char (*buf)[.len]; > > > }; > > > > > > > > > This has less issues because the size of the struct then does not depend > > > on the length. > > but I am still not clear on why "the size of the above struct 'foo' does not > depend on the .len?" in my opinion, it should depend on .len. do I miss > anything here? Here the last element is not a flexible array member but a pointer to an array of size len. The size of the pointer is fixed. Martin >