News for hackers. Stuff that matters.
Re:A nice, little known C feature: Static array indices in p... by yxhuvud on Monday February 18, 2013 @12:36PM (#5239417)
[I'm away from a C compiler and can't test]:

What happen if you do

void bar(int fooArray[static 0]) {} ?

Is NULL allowed?

Re:A nice, little known C feature: Static array indices in p... by ehamberg on Monday February 18, 2013 @12:41PM (#5239446)

    test.c:3:30: warning: 'static' has no effect on zero-length arrays [-Warray-bounds]
Re:A nice, little known C feature: Static array indices in p... by quasive on Monday February 18, 2013 @03:25PM (#5240399)
According to section 6.7.5.2p1 of C99: “If the expression is a constant expression, it shall have a value greater than zero.”

The “expression” here refers to an expression in between [] in an array declaration; so the declaration of size 0 is a constraint violation and requires a diagnostic. You can get gcc and clang to issue a relevant diagnostic with “-std=c99 -pedantic”.