4 ms·
Did you mean the other way around? I think someArray[] is a flexible array member and someArray[0] is a constraint violation.
by timmaxw 10y ago
Did you mean the other way around? I think someArray[] is a flexible array member and someArray[0] is a constraint violation.
- sigjuice 10y agoYou are right. OP has it backwards. gcc treats someArray[0] almost the same as someArray[]. https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/Zero-Length.html#Zero-Length https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/Zero-Length.htm... Other compilers might have similar treatment for someArray[0].
- tavert 10y agoJust don't try to have both a zero sized array and a flexible array in the same struct. g++ 5 or earlier will compile that, but g++ 6 will not: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69550 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69550