V2 string

Derek Parnell derek at psych.ward
Thu Jul 5 05:10:15 PDT 2007


On Thu, 05 Jul 2007 01:06:45 -0700, Walter Bright wrote:

> Derek Parnell wrote:
>> However, if I might need to update it ...
>> 
>>    char[] fullpath;
>> 
>>    fullpath = CanonicalPath(shortname).dup;
>>    version(Windows)
>>    {
>>       setLowerCase(fullpath);
>>    }
>> 
>> The point is that the 'CanonicalPath' function hasn't got a clue what the
>> calling function is intending to do with the result so it is trying to be
>> responsible by guarding it against mistakes by the caller.
> 
> If you write it like this:
> 
> string fullpath;
> 
> fullpath = CanonicalPath(shortname);
> version(Windows)
> {
>        fullpath = std.string.tolower(fullpath);
> }
> 
> you won't need to do the .dup .

If you have any failing Walter, its your ability to focus on insignifacnt
minutia as a form of distraction from the point that people are really
trying to make.

I was not talking about how to do efficient lower case conversion. 

I'll make my code example more free from assumed functionality.


 char[] qwerty;
 
 qwerty = KJHGF(poiuy).dup;
 version(xyzzy)
 {
     MNBVC(qwerty);
 }

As you can see, my point is made without regard to converting stuff to
lower case.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list