Compare struct against null
Heinz
malagana15 at yahoo.es
Mon Apr 28 21:50:18 PDT 2008
downs Wrote:
> Heinz wrote:
> > Hi,
> >
> > I have a simple struct and i want to check if a variable has been asigned:
> >
> > struct hello
> > {
> >
> > }
> > ...
> > hello h;
> > ...
> > if(!h)
> > {
> > do stuff;
> > }
> >
> > When compiling i get erros about opCall not implemented and many others. What can i do?
> >
> > Thanks in advance.
>
> Structs are value types. Read the spec. Then use a pointer :)
>
> hello* h;
>
> if (!h) h = new hello;
>
> --downs
Thanks for your reply. Can i use then?:
hello h;
if(!&h)
More information about the Digitalmars-d-learn
mailing list