Manifest constants (was const again)

Bruce Adams tortoise_74 at yeah.who.co.uk
Sat Dec 8 15:50:33 PST 2007


On Sat, 08 Dec 2007 23:19:07 -0000, Bill Baxter  
<dnewsgroup at billbaxter.com> wrote:

> Jérôme M. Berger wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>  Walter Bright wrote:
>>> Derek Parnell wrote:
>>>> For example ...
>>>> enum
>>>> {
>>>>    defname = "upload.log",
>>>>    float fudge = 61.74,
>>>>    char starter = 'r',
>>>>    qwerty = 0xF4,
>>>>    foobar = SomeFunc("foobar")  }
>>> No, that would be:
>>>
>>>     enum defname = "upload.log";
>>>     enum float fudge = 61.74;
>>>     enum char starter = 'r';
>>>     enum qwerty = 0xF4;
>>>     enum foobar = SomeFunc("foobar");
>>  	So, basically, what you're saying is that not only enum is a list
>> with only one element, but it's a list that can never have more than
>> one element?? What kind of enumeration is that?
>
> That is amusing.  So Walter, why not allow more than one element?
>
> --bb

If it was really a list you could usefully have an empty one.
I suspect the objection is mixing multiple types in one declaraiton.

enum
{
    a = 1;
    b = 2;
}

makes sense in a way that:

enum
{
   a = 1;
   b = "foo";
}

does not.



More information about the Digitalmars-d mailing list