On 09/04/2011 18:44, Andrej Mitrovic wrote:
On 4/9/11, Andrej Mitrovic<andrej.mitrov...@gmail.com>  wrote:
That's great, I can use it to print out all the fields. Thanks!

Some error checking should be done, or maybe there's a bug. If a field
has a type that is a typedef to say a void*:
typedef void* HANDLE

struct S
{
     HANDLE hnd;
}

Printing hnd will fail with an error:

D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(1599): Error:
function 
std.format.formatValue!(LockingTextWriter,HANDLE,immutable(char)).formatValue
is deprecated
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(308): Error:
template instance
std.format.formatGeneric!(LockingTextWriter,HANDLE,immutable(char))
error instantiating
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(701):
instantiated from here:
formattedWrite!(LockingTextWriter,immutable(char),HANDLE)
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(1598):        instantiated
from here: writefln!(string,HANDLE)
hello_msg.d(35):        instantiated from here: writefln!(string,HANDLE)
hello_msg.d(129):        instantiated from here: print!(PAINTSTRUCT)

For now you can compile with -d, this should be reported as a bug though.

Btw, why are we not allowed to have mixin templates that have
statements? Why only declarations?

Dunno, never made sense to me... Could be a question for d.D.

--
Robert
http://octarineparrot.com/

Reply via email to