July 12, 2004 writef(Object) just writes a random number | ||||
---|---|---|---|---|
| ||||
Using DMD 0.95, Windows 98SE.
According to std_format.html, for the %s format
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.
I see you haven't tested this yet. Well I have, and it's just throwing random numbers at me:
18314152873893856
4301856736
Stewart.
----------
import std.stdio;
class Qwert {
char[] toString() {
return "yuiop";
}
}
void main() {
Qwert asdfg = new Qwert;
writefln(asdfg);
writefln("%s", asdfg);
}
--
My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
|
July 12, 2004 Re: writef(Object) just writes a random number | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | In article <cctog6$18bq$4@digitaldaemon.com>, Stewart Gordon says... > >Using DMD 0.95, Windows 98SE. > >According to std_format.html, for the %s format > >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. > > >I see you haven't tested this yet. Well I have, and it's just throwing random numbers at me: > >18314152873893856 >4301856736 it's probably the same as http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/770 Ant |
Copyright © 1999-2021 by the D Language Foundation