default opAssign(string) behaviour

Simen kjaeraas simen.kjaras at gmail.com
Thu Jan 28 07:52:00 PST 2010


On Thu, 28 Jan 2010 09:02:12 +0100, Simen kjaeraas  
<simen.kjaras at gmail.com> wrote:

> On Thu, 28 Jan 2010 02:32:20 +0100, strtr <strtr at spam.com> wrote:
>
>> Personally, I use (D1)std2.conv a lot to get values from strings and  
>> thus would love the following default behaviour for all types:
>>
>> int i = "0"; // i = 0
>> i = cast( int ) "0"; // i = 48 ( If I read the utf8 table correctly )
>

Also, casting the string "0" to an int is gonna engender you the pointer
to the first character of that string, not its value. So more likely,
cast( int )"0" will produce something more akin to 4383140.

-- 
Simen


More information about the Digitalmars-d-learn mailing list