Do we really need const?

Regan Heath regan at netmail.co.nz
Tue Sep 18 03:48:36 PDT 2007


Janice Caron wrote:
> On 9/18/07, Regan Heath <regan at netmail.co.nz> wrote:
>> Bill Baxter wrote:
>>> Regan Heath wrote:
>>>> renoX wrote:
>>>>> Bruce Adams a écrit :
>>>>>> An example of one that catches me out quite often is:
>>>>>> strcpy(src,dest) vs. strcpy(dest,src);
>>>>> Let's try it: do you think you would make the same mistake if you
>>>>> would call your function this way:
>>>>> char[50] var_dest, my_src;
>>>>> strcpy(dest: var_dest, src: my_src)
>>>> My eyes... aaarghh!
>>> Is it the particular syntax or the concept you object to?
>> Not sure, it just makes my skin crawl at the moment.
> 
> Of course, for copying strings in D, we already have the vastly superior syntax
> dst = src;
> 
> :-)

You mean of course:

dst = src.dup

;O)



More information about the Digitalmars-d mailing list