Daniel Shahaf <[email protected]> writes:
> Is this loop iteration style valid for empty arrays? Looking at C89, it's not
> clear to me that sizeof(x[0]) is well-defined for empty arrays.
It builds without warnings using 'gcc -std=c89' but fails if I add
'-pedantic':
../src/subversion/libsvn_subr/errorcode.inc:6:18: warning: ISO C forbids empty
initializer braces [-Wpedantic]
} svn__errno[] = {
^
../src/subversion/libsvn_subr/errorcode.inc:6:3: error: zero or negative size
array ‘svn__errno’
} svn__errno[] = {
^~~~~~~~~~
I suppose I could insert a dummy entry for zero. The code that uses the
array will never look for zero since there is an earlier return.
--
Philip