Odd to!string call

Steven Schveighoffer schveiguy at yahoo.com
Tue Dec 21 10:43:08 PST 2010


On Tue, 21 Dec 2010 13:38:06 -0500, Andrej Mitrovic <none at none.none> wrote:

> I found this by accident:
>
> import std.stdio;
> import std.conv;
>
> void main()
> {
>     writeln(to!string(2, 2));  // writes 10
>     writeln(to!string(1, 0));  // std.conv.ConvException: Radix error
> }
>
> I'm not sure why "std.conv.to" would even take multiple arguments.  
> Bugzilla?

Would guess that the second arg is the base to use?  2 in base-2 (binary  
is 10), and radix usually means the base.

Just looked it up, go to this page and search for 'radix':  
http://www.digitalmars.com/d/2.0/phobos/std_conv.html

-Steve


More information about the Digitalmars-d-learn mailing list