Broken C array autosizing breaks glibc compile

Kaz Kylheku kaz@ashi.footprints.net
Thu Sep 21 15:08:00 GMT 2000


On Thu, 21 Sep 2000, Franz Sirl wrote:

> > The only reasonable thing would be for the compiler to emit a diagnostic,
> > like ``too many elements in initializer for array dimension''.
> 
> Well, I seemed to remember this is a GCC extension (especially since -Wall 
> didn't warn and it was working with earlier compilers), but looking in the 
> docs I cannot find it...
> 
> So if it's no GCC extension, the bug is in glibc's repertoire.c.

I believe it's an extension, but it's only useful in structs, where the
array declaration creates a ghost pseudo-member for generating a pointer to the
region of memory where an array would otherwise have been placed.  So it can be
used, e.g. as a refinement to the ``struct hack'':

	struct header {
	    size_t size;
	    int type;
	    char variable_data[0];
	};



More information about the Libc-alpha mailing list