Re:What is “:-!!” in C code?
by Mindless2112 on Monday November 21, 2016 @02:04AM
(#13003722)
Ah, good point. One more reason for me to hate VLAs. ;)
The negative-length array trick is used in the Linux kernel source code [1]. I expect it's compiled with -Wvla though.
[1] https://github.com/torvalds/linux/blob/v4.5/arch/x86/boot/bo...
Looks exactly like the macro Jan Beulich replaced with the one discussed in OP: https://github.com/torvalds/linux/commit/8c87df457cb58fe75b9...
For example, this compiles but segfaults at runtime (GCC 4.9.2):
[1] https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html