| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
July 29, 2004 0.97 the info code for classes still wrong | ||||
|---|---|---|---|---|
| ||||
you didn't fix it yet...
this prevents me from using the new writef... :(
##############
private import std.stdio;
class A
{ char[] toString()
{ return "There";
}
}
void main()
{
writefln("Hello %d a=%s", 1, new A);
}
#############
$ dmd Write.d -I~/dmd/src/phobos
gcc Write.o -o Write -lphobos -lpthread -lm
$ Write
Hello 1 a=-4611693542134431776
#############
Ant
| ||||
July 30, 2004 Re: 0.97 the info code for classes still wrong | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ant | ummmmm..
private import std.stdio;
class A
{
char[] toString()
{
return "There";
}
}
void main()
{
writefln("Hello %d a=%s", 1, (new A).toString());
}
is D supposed to support implicit conversions from objects to char[]?
| |||
July 30, 2004 Re: 0.97 the info code for classes still wrong | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | On Fri, 30 Jul 2004 01:06:44 -0400, Jarrett Billingsley wrote: > is D supposed to support implicit conversions from objects to char[]? http://www.digitalmars.com/d/std_format.html#format-string FormatChar 's' The corresponding argument is formatted in a manner consistent with its type: bit The result is 'true' or 'false'. integral types The %d format is used. floating point types The %g format is used. string types The result is the string converted to UTF-8. A Precision specifies the maximum number of characters to use in the result. classes derived from Object The result is the string returned from the class instance's .toString() method. A Precision specifies the maximum number of characters to use in the result. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply