Type.stringof
Lionello Lunesu
lio at lunesu.remove.com
Thu Feb 22 04:54:40 PST 2007
Michiel wrote:
> Walter Bright wrote:
>
>>> The documentation sais that all types should have the property
>>> .stringof, but it doesn't seem to work. Has it been renamed? Or doesn't
>>> it exist (anymore)?
>> In what case does it not work?
>
> Any case. I tried this:
>
> ------------------------------------------
> module test;
>
> import std.stdio;
>
> struct Foo { }
>
> enum Enum { RED }
>
> typedef int myint;
>
> void main()
> {
> writefln((1+2).stringof); // "1 + 2"
> writefln(Foo.stringof); // "Foo"
> writefln(test.Foo.stringof); // "test.Foo"
> writefln(int.stringof); // "int"
> writefln((int*[5][]).stringof); // "int*[5][]"
> writefln(Enum.RED.stringof); // "Enum.RED"
> writefln(test.myint.stringof); // "test.myint"
> writefln((5).stringof); // "5"
> }
That works just fine here, DMD 1.007
L.
More information about the Digitalmars-d
mailing list