Thread overview | |||||
---|---|---|---|---|---|
|
June 02, 2005 std.string.toString() with radix function | ||||
---|---|---|---|---|
| ||||
socket.d(111): function std.string.toString called with argument types: (ulong,int) matches both: std.string.toString(long,uint) and: std.string.toString(ulong,uint) code: int i = 15; char [] ui; ui = std.string.toString(cast(ulong)i,16); what`s up with it? |
June 02, 2005 Re: std.string.toString() with radix function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phoenix | > socket.d(111): function std.string.toString called with argument types: > (ulong,int) > matches both: > std.string.toString(long,uint) > and: > std.string.toString(ulong,uint) > > > code: > > int i = 15; > char [] ui; > ui = std.string.toString(cast(ulong)i,16); > > what`s up with it? The parameter 16 is signed int by default. D has far simpler overloading rules than C++, and these produce the collision here. Use that instead: ui = std.string.toString(cast(ulong)i, 16u); Ciao uwe |
June 02, 2005 Re: std.string.toString() with radix function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Uwe Salomon | Uwe Salomon napsal(a):
>> socket.d(111): function std.string.toString called with argument types:
>> (ulong,int)
>> matches both:
>> std.string.toString(long,uint)
>> and:
>> std.string.toString(ulong,uint)
>>
>>
>> code:
>>
>> int i = 15;
>> char [] ui;
>> ui = std.string.toString(cast(ulong)i,16);
>>
>> what`s up with it?
>
>
> The parameter 16 is signed int by default. D has far simpler overloading rules than C++, and these produce the collision here. Use that instead:
>
> ui = std.string.toString(cast(ulong)i, 16u);
>
> Ciao
> uwe
thanks, it works fine.
|
Copyright © 1999-2021 by the D Language Foundation