This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: No effect of -fshort-enums..is it a bug
- From: Neil Booth <neil at daikokuya dot co dot uk>
- To: "Gaurav Gautam, Noida" <gauravga at noida dot hcltech dot com>
- Cc: gcc at gcc dot gnu dot org, gcc-help at gcc dot gnu dot org
- Date: Fri, 23 Sep 2005 00:32:10 +0900
- Subject: Re: No effect of -fshort-enums..is it a bug
- References: <40CC5CC7CDACC048B1299C57025E330CFD6CC2@HSDLNTD1110010.noida.hcltech.com>
Gaurav Gautam, Noida wrote:-
> #include <stdio.h>
> int main()
> {
> enum aa {
> a = 0, b =127 , c
> };
> printf("size = %d %d %d\n", sizeof(enum aa),sizeof(b),sizeof(c));
> printf("value= %d %d %d\n", a,b,c);
> return 0;
> )
>
> The output is
> size = 1 1 1
> value= 0 127 128
> when gcc (GCC) 3.3.1 (SuSE Linux) is used with -fshort-enums.
>
> And
>
> size = 1 4 4
> value= 0 127 128
> when (GCC) 4.1.0 20050915 (experimental) is used with -fshort-enums.
>
> Please confirm which of the two outputs is correct and why is there a
> difference in the output of two versions of compiler?
4.1.0 is correct, therefore 3.3.1 was buggy.
Neil.