Manifest constants (was const again)

Bill Baxter dnewsgroup at billbaxter.com
Sat Dec 8 11:54:07 PST 2007


Janice Caron wrote:
> On 12/8/07, Walter Bright <newshound1 at digitalmars.com> wrote:
>> No, that would be:
>>
>>      enum defname = "upload.log";
>>      enum float fudge = 61.74;
>>      enum char starter = 'r';
>>      enum qwerty = 0xF4;
>>      enum foobar = SomeFunc("foobar");
> 
> The first one is interesting. Can I do
> 
>     enum s = "hello";
>     auto p = s.ptr;
> 
> ?

The enum proposal was just to make enum take over for const in declaring 
manifest constants.  Not to change the behavior of manifest constants.

So whatever const s = "hello" does now in D2 should be what it does in 
the next iteration with enum s = "hello".

--bb



More information about the Digitalmars-d mailing list