On Sun, Feb 7, 2010 at 2:46 AM, Charles Forsyth <fors...@terzarima.net>wrote:

> h% cat en.c
> enum{
>        Fred= 1.5
> };
> double f = Fred;
> h% 8c -S en.c
>        DATA    f+0(SB)/8,$(1.50000000000000000e+00)
>        GLOBL   f+0(SB),$8
>        END     ,
>
> bug or quirk?
> what do you think?
>

i swear i tested this before i replied...

seems like a bug to me.  the spec is pretty clear:

       6.7.2.2  Enumeration specifiers

       Syntax

       [#1]

               enum-specifier:
                       enum identifier-opt { enumerator-list }
                       enum identifier-opt { enumerator-list , }
                       enum identifier

               enumerator-list:
                       enumerator
                       enumerator-list , enumerator

               enumerator:
                       enumeration-constant
                       enumeration-constant = constant-expression

       Constraints

       [#2] The expression that defines the value of an enumeration
       constant shall be an integer constant expression that has  a
       value representable as an int.

russ

Reply via email to