Question

While reading the Clang documentation, I came across the following intriguing tidbit: [1]

clang does not support the gcc extension that allows variable-length arrays in structures. This is for a few reasons: one, it is tricky to implement, two, the extension is completely undocumented, and three, the extension appears to be rarely used. Note that clang does support flexible array members (arrays with a zero or unspecified size at the end of a structure).

How can this extension be used? My understanding is that using alloca within a constructor causes the stack pointer to be restored at the end of the calling function, which in this case would be the constructor -- not at the end of the enclosing struct.

Thanks for the help!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top