www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - 0.97 the info code for classes still wrong

reply Ant <duitoolkit yahoo.ca> writes:
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
Jul 28 2004
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
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[]?
Jul 29 2004
parent reply Ant <duitoolkit yahoo.ca> writes:
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.
Jul 29 2004
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
ooh.
Aug 02 2004