DMD 1.004 release
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Sun Jan 28 17:33:10 PST 2007
Jarrett Billingsley wrote:
> "Lionello Lunesu" <lionello at lunesu.remove.com> wrote in message
> news:ephjmf$12sd$1 at digitaldaemon.com...
>>
>> Shouldn't string literals be forced "const"? Even D's limited const could
>> do that. To create a mutable copy you'd be forced to used .dup.
>>
>> const char[] either = "asdfsadf";
>> char[] or = "asdfsd".dup;
>>
>
> That wouldn't help, because even if you pass a const char[] into a function
> that takes a char[], that function can still modify it. The const goes
> away.
This was kind of "forced by design" because const was a storage class
not allowed in function arguments. D will do the right thing as soon as
it gets full-fledged const.
Andrei
More information about the Digitalmars-d-announce
mailing list