PhobosWatch: manifest => enum

Steven Schveighoffer schveiguy at yahoo.com
Fri Dec 28 11:46:49 PST 2007


"Jason House" wrote
> Walter Bright wrote:
>> The idea is that for anonymous enums, there is no type for the
>> enumeration as a whole. Therefore, each member of the enumeration can
>> have a different type.
>
> ... so annonymous enums have no type for the enumeration as a whole, but
> named enums will?  Can named enums have a type other than int?

This currently works:

enum X : long
{
  one = 1L,
  two = 2L
}

This also currently works:

enum : long
{
  one = 1L,
  two = 2L
}

Enums can currently be based on any integral type.

That brings up a couple of questions.  Under the new regime, what happens 
with this code:

enum {one, two}

enum : long {one, two}

enum : float {one, two}

enum
{
  float one = 1.0,
  two
}

and will enums in curly braces that are manifest constants have to be 
specified with semicolons or commas?

???

-Steve 





More information about the Digitalmars-d mailing list