How would You make abstract HANDLE?

Mariusz Gliwiński alienballance at
Wed Jan 19 18:20:10 PST 2011

2011-01-19 19:23, Simon wrote:
> Traditionally:
> struct dummy;
> alias dummy* HANDLE;
> void doSomething(HANDLE h) {
> }
> Just don't provide a body for dummy to keep it abstract.
So, if I understood  correctly I can't transparently swap pointer with 
integer of the same size? Fair enough, but:
struct _handle;
alias _handle* HANDLE;

struct _handle {
     uintptr_t val;
class A : iface {
     void doSomething(HANDLE h) {
         assert(node.val < _t.length);    //HERE

a.d (HERE): Error: struct _handle is forward referenced

Which means that he doesn't really see _handle defined, even if it's 
defined few lines above. Am i doing something wrong?

Mariusz Gliwiński

More information about the Digitalmars-d-learn mailing list