[Mono-devel-list] Comparing against null
joe at otee.dk
Thu Apr 7 18:01:56 EDT 2005
> A couple of suggestions:
> By the way, why do you need a customized version of operator==? What kind of
> operations are you needing to do in there?
I am checking if the C++ representation has not already been destroyed.
Which for all practical purposes means that the C# object is null.
> You might try this workaround: change the comparison ``t == null'' to
> ``t == (Type) null''.
That is not possible, we are creating a release quality product. I can't
reasonably require our customers to write such code.
Is there a way to make the compiler give compile errors when the user is
about to use the comparison operator? Disabling it completely is at least
better than wrong behaviour.
> On Thursday 07 April 2005 11:56 am, you wrote:
>> In our game engine we wrap C++ objects with small mono objects.
>> The C++ representation might be destroyed. We use a lot of weak referencing
>> and I want it to be straightforward to use.
>> Comparing against null is the obvious way to do that.
More information about the Mono-devel-list