How to check for null references
Hans-Eric Grönlund
hasse42g at gmail.com
Mon Aug 27 06:10:36 PDT 2007
Thank you! I'll direct the basic questions to the learn-newsgroup from now on.
/Hans-Eric
Carlos Santander Wrote:
> Hans-Eric Grönlund escribió:
> > Hi all!
> >
> > I'm trying to learn D, mostly by trial and error, and I keep tripping over
> > the smallest rocks. This time the pebble is: How can I gracefully check if an
> > object reference is null? I get an access violation if I try this and the
> > reference (o) is null:
> >
> > if (o == null) {...}
> >
> > Is this a bug in DMD (I use the stable 1.x version) or did I miss something
> > obvious?
>
> Use: if (o is null) {...}
>
> >
> > Best regards
> >
> > Hans-Eric Grönlund Software Developer, Project Manager, Freelance Journalist
> > http://www.hans-eric.com/
>
> Since you're learning D, questions like this one are better suited for the
> D.learn newsgroup.
>
> --
> Carlos Santander Bernal
More information about the Digitalmars-d
mailing list