C++/CLI how to assign null?

L

Lenard Gunda

Hey,

How can I assign 'null' value to a handle in C++/CLI?
I searched for this for some while now, finding nothing so far.

In C# I could write:

something = null;

or

if ( something == null ) ...

However, C++/CLI does not understand null. NULL is not defined, and it
shouldn't be. Also, in Managed C++ I could use 0 instead of null, but that
doesn't work either anylonger.

So, anyone has a solution? :)

Thanks
-Lenard
 
C

Carl Daniel [VC++ MVP]

Lenard said:
Hey,

How can I assign 'null' value to a handle in C++/CLI?
I searched for this for some while now, finding nothing so far.

In C# I could write:

something = null;

or

if ( something == null ) ...

However, C++/CLI does not understand null. NULL is not defined, and it
shouldn't be. Also, in Managed C++ I could use 0 instead of null, but
that doesn't work either anylonger.

So, anyone has a solution? :)

nullptr

-cd
 
G

Geoffroy

Hi,

In C++/CLI, just write :

something = nullptr;
if (!something)
if (something == nullptr)

Geoffroy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top