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.

Reply via email to