C++/CLI how to assign null?

  • Thread starter Thread starter Lenard Gunda
  • Start date Start date
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
 
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
 
Hi,

In C++/CLI, just write :

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

Geoffroy
 
Back
Top