@b4n requested changes on this pull request.

The C standard forbids zero-size arrays. Yes, GCC and Clang do allow them as an extension (yet it's not truly 0-sized, but basically a VLA), GCC even discourages usage in your use case:

Declaring zero-length arrays [anywhere but as the last member of a structure], including as interior members of structure objects or as non-member objects, is discouraged

At any rate, it's not valid ISO C, so any compiler would be right to forbid it. And both GCC and Clang are unhappy about them when passed -pedantic (GCC: error: zero or negative size array ‘foo’, CLang: warning: zero size arrays are an extension [-Wzero-length-array]).


It's sad Clang doesn't see that the NULL check makes its warning moot, but the fix you propose is not OK as it's not valid C -- and thus likely rejected (rightly) by some compilers (I would guess MSVC might not like it, and maybe some other less common ones).


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.