DMD 1.004 release

Lionello Lunesu lionello at lunesu.remove.com
Sun Jan 28 12:41:43 PST 2007


"Jarrett Billingsley" <kb3ctd2 at yahoo.com> wrote in message 
news:epikg9$2lmu$1 at digitaldaemon.com...
> "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.

Perhaps, but at least assignments of string literals to variables would be 
clearly marked as const, and functions written with Copy On Write in mind 
would have no problems with const strings passed to them.

L. 





More information about the Digitalmars-d-announce mailing list