nullptr

What exactly is nullptr in C++0x?

Most of C++ programmers are waiting for C++0x. An interesting feature and a confusing one (at least for me) is the new nullptr. Well, no need anymore for the nasty macro NULL. int* x = nullptr; myclass* obj = nullptr; Still, I am not getting how nullptr works. For example, Wikipedia article says: C++0x aims to correct this by i...

C++: Cannot instantiate a pointer directly

This is an SDL problem, however I have the strong feeling that the problem I came across is not related to SDL, but more to C++ / pointers in general. To make a long story short, this code doesn't work (edited to show what I really did): player->picture = IMG_Load("player"); SDL_BlitSurface(player->picture, NULL, screen, &pictureLocati...

Can nullptr be emulated in gcc?

I saw that nullptr was implemented in Visual Studio 2010. I like the concept and want to start using it as soon as possible; however GCC does not support it yet. My code needs to run on both (but doesn't have to compile with other compilers). Is there a way to "emulate" it? Something like: #define nullptr NULL (but obviously that wou...

How to enable nullptr from C++0x in the Visual C++ 2010?

I wonder how can I enable the nullptr in the just released Visual Studio 2010. (C++ project, not managed). This is one of the new features but it is not available by default and looking inside the documentation at http://msdn.microsoft.com/en-us/library/4ex65770(VS.100).aspx it seams that it is enabled by /clr but this is managed! Is t...

What header file needs to be included for using nullptr in g++?

I am using g++ 4.4.1 and want to use nullptr, but I am not being able to find which header file is required to be included. It does not seem to be keyword either, because my attempt to use it is rejected as error: 'nullptr' was not declared in this scope ...