Re: Question about "enums"




Ian Collins wrote:
mdh wrote:
Ian Collins wrote:

oklopp us a variable of the enum type loop, so you can assign either NO
or YES to it.


An enum is a type, which in this case can have one of two values, YES
and NO.

Assigning any other value to a loop is undefined. Unfortunately C
compilers don't regard this as an error, which renders enums little more
than symbolic constants.

gcc gives a warning when you do a switch on an enum type, indicating
that you have failed to explicitely specify behavior for any of the
listed cases. I find that very useful.

.



Relevant Pages

  • Re: optional param in Method
    ... Optional ByVal db_Type As FbDbType = ... really an Integer type and cannot be initialized to "Nothing". ... Assigning Nothing to a value typed variable means assigning the "default value". ... An enum is stored as an Integer value. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Question about "enums"
    ... enum loop ... Assigning values other than the constants declared in the enumeration are not necessarily undefined by the C Standard. ... The implementation must assign the enum to an integer type which will hold all the enumeration constants. ...
    (comp.lang.c)
  • Re: Question about "enums"
    ... Bill Pursell wrote: ... An enum is a type, which in this case can have one of two values, YES ... Assigning any other value to a loop is undefined. ... enum loop; ...
    (comp.lang.c)
  • Re: default values to enum ?
    ... > creating an enum variable it shuld be INITIALIZED to certain default values ... or do i have to write some function for assigning values to ... Consider enum Color; ...
    (comp.lang.cpp)
  • Re: Enum type check in function call
    ... Got a function that takes in a enumerated type. ... The /constants/ are just ints, but the `enum wossname`s aren't; ... Ian Collins. ...
    (comp.lang.c)