3 ms·
> A zero size array is better thought of as a pointer to that part of the struct, ... An array of any size is best thought of as an array. Arrays are not point
by _kst_ 10y ago
> A zero size array is better thought of as a pointer to that part of the struct, ...
An array of any size is best thought of as an array. Arrays are not pointers. (See section 6 of the comp.lang.c FAQ, http://www.c-faq.com/. http://www.c-faq.com/.)
A zero size array is best thought of as illegal (if you want portability) or as a compiler-specific extension (if you don't mind depending on a particular compiler, perhaps gcc).
- jandrese 10y agoTechnically correct, but using the zero length array trick creates clearer, more self documenting code. It's a tradeoff between readability and portability.
- _kst_ 10y ago> Technically correct, Or, as I prefer to say, "correct". > but using the zero length array trick creates clearer, more self documenting code. It's a tradeoff between readability and portability. Clearer compared to which alternative? I find C99-style flexible array members (defined with "[]") quite clear.