This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 2.95/C: flexible array member as error, breaks ISO C
- To: Fieldhouse at logica dot com
- Subject: Re: gcc 2.95/C: flexible array member as error, breaks ISO C
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 17 Feb 2000 20:35:01 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <ABDA876D71F9D211B39D0090274EA8E20140B5B7@Floyd.logica.co.uk>
> 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