DMD 1.004 release

Brad Roberts braddr at puremagic.com
Sun Jan 28 12:49:02 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. 

I sincerely hope that passing a const T through an api asking for a T 
will be illegal once D starts to grow some const abilities.  If not, 
what's the point of the const declaration?  So, the above will 
definitely help.

Later,
Brad



More information about the Digitalmars-d-announce mailing list