[Issue 9588] format prints context pointer for struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 25 18:11:50 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9588
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|format prints "null" for |format prints context
|struct functions |pointer for struct
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-02-25 18:11:48 PST ---
(In reply to comment #0)
> import std.string;
> import std.stdio;
>
> void main()
> {
> struct S { int x; bool empty() { return false; } }
> writeln( format("%s", S()) );
> }
>
> > S(0, null)
>
> It shouldn't try to print the function. I think this should also apply to
> property functions since e.g. "empty" is typically a property function.
Oh wait a minute, I know what this is. It's the hidden context pointer. If you
change the struct to 'static' the null disappears. But I don't think format()
should print that.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list