gcc 2.95/C: flexible array member as error, breaks ISO C

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Thu Feb 17 11:49:00 GMT 2000


> However your proposed work-around is specifically prohibited at ISO 6.7.5.2
> (constant array dimension must be > 0). 

Yes, that's a GNU C extension. 'gcc -pedantic' should diagnose it as
such.

> I went for 
> 
> #ifdef __GNUC__
>  	ClnpT_MacIf		mac_intf_tbl[1];
> #else
>  	ClnpT_MacIf		mac_intf_tbl[];
> #endif
> 
> This is fine except that an array bounds check might fail.

This is indeed the obvious approach.

Regards,
Martin


More information about the Gcc-bugs mailing list