const issues and more!

Bill Baxter dnewsgroup at billbaxter.com
Mon Jan 14 12:01:17 PST 2008


Walter Bright wrote:
> Neil Vice wrote:
>> Firstly the following simple initialiser fails to compile:
>>
>>     char[] text = "text";
>>
>> As far as I can tell there is no way to declare and initialise an 
>> array in a single line of code
> 
>     string text = "text";

My intuition is that an implicit dup should happen.
Why?  Well, maybe it's just familiarity with C++?

   std::string text = "hello"; // makes a copy
   text[0] = 'b'; // ok because we have a copy

--bb



More information about the Digitalmars-d mailing list