bud and lib paths

Derek Parnell derek at nomail.afraid.org
Tue Oct 16 23:21:46 PDT 2007


On Wed, 17 Oct 2007 14:11:13 +0900, Bill Baxter wrote:

> 
> Eek, you mean this
>     char[] x;
>     x ~= std.path.sep;
> 
> Has to be written
>     char[] x;
>     x ~= std.path.sep.idup;
> 
> ??
> That seems like a bug.  You're not modifying sep at all.  Maybe the 
> built-in "opCatAssign" is not declared as taking const like it should?

Not really. The problem is that these constant literals are defined as
'const char' and not 'invariant char'. This below illustrates the
problem...


 invariant char[1] IS = "/";
 const     char[1] CS = "/";

 void main()
 {
    string[] x;

    x ~= IS; // Okay
    x ~= CS; // Fails
 }

To get around this I need to ...

   x ~= CS.idup;


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
17/10/2007 4:17:40 PM


More information about the Digitalmars-d-learn mailing list