Jump to content
  • Advertisement
Sign in to follow this  
Zido_Z

Null is undefined.

This topic is 2566 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm confused. Visual Studio is flagging the NULL word as undefined. I thought NULL was a system constant for C++. Did something change or is there a replacement for NULL? I cannot even check if a variable is null in an if condition.

Share this post


Link to post
Share on other sites
Advertisement
NULL is not a feature of C++.

Many libraries (including Windows), often include the code:#ifndef NULL
#define NULL 0
#endif

Depending on which headers you've included, NULL may or may not be defined as 0. If you want to use NULL (and not just use 0), but you haven't included one of these headers in your CPP file, you can just use the above code to define it yourself.

Share this post


Link to post
Share on other sites
Please do not mark threads "solved" in this forum.

Prior to posting again, please be sure to read the forum rules and abide by them.


Thank you!

Share this post


Link to post
Share on other sites
VC 2010 also supports the new C++0x [color="#0000FF"]nullptr keyword, which is a type-safe version of NULL or 0.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!