https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gcc/Zero-Length.htm...
Other compilers might have similar treatment for someArray[0].
edit: clarifying, I thought int somearray [] was the same as int* somearray.
/* file scope */
int a[];
/* later in same translation unit, or in another one: */
int a[42];
In this case, we get an "incomplete array type" after the first declaration. The storage size isn't known and so sizeof a cannot be computed.This is also a de facto kind of "flexible array", but not formally named such.
For instance we can do this:
/* In proprietary kernel source code */
/* Size deliberately unspecified */
extern struct driver driver_table[];
The proprietary kernel code is compiled into .o files and linked into a .a archive library.To complete the build, a driver table module must be added and some drivers. The module which defines driver_table can be open-source. It defines the size of driver_table by how many entries there actually are; users can configure as many or few drivers and re-build the kernel, without having to recompile the proprietary part in the .a archive.
Unixes were shipped like this once upon a time. The "device major number" is just the position in the device table.