You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This program shows the current default printing of class instances (dmd 2.067alpha):
class Foo {}
void main() {
import std.stdio;
Foo f;
f.writeln;
f = new Foo;
writeln(f, " ", cast(void*)f);
}
Output:
null
test.Foo 2001FE0
But perhaps it's better for D writeln to print class instances (that don't have a toString) more like Java:
test.Foo@null
test.Foo@2001FE0 2001FE0
This is useful in debugging and code development, because the address allows to see what class instances are equal.
The text was updated successfully, but these errors were encountered:
bearophile_hugs reported this on 2014-11-04T10:45:58Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=13680
Description
This program shows the current default printing of class instances (dmd 2.067alpha): class Foo {} void main() { import std.stdio; Foo f; f.writeln; f = new Foo; writeln(f, " ", cast(void*)f); } Output: null test.Foo 2001FE0 But perhaps it's better for D writeln to print class instances (that don't have a toString) more like Java: test.Foo@null test.Foo@2001FE0 2001FE0 This is useful in debugging and code development, because the address allows to see what class instances are equal.The text was updated successfully, but these errors were encountered: