[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-devel-list
Subject:    Re: [Mono-devel-list] Comparing against null
From:       Michal Moskal <michal.moskal () gmail ! com>
Date:       2005-04-09 9:00:52
Message-ID: b323bb98050409020055b2d934 () mail ! gmail ! com
[Download RAW message or body]

On Apr 9, 2005 1:07 AM, Jonathan Gilbert <2a5gjx302@sneakemail.com> wrote:
> :-), simply because nobody has mentioned it yet, that there IS an official
> way to always do a reference check: ReferenceEquals(a, b). I do not know if
> the JIT recognizes when this compares against null and simplifies it to
> brtrue/brfalse, but it seems like an obvious -- and simple -- thing to do
> (just need to be careful that the user hasn't created their own 'new'
> static ReferenceEquals function).

Well, there is an easier way, which is clearly optimized:

  (object)foo == (object)bar

-- 
   Michal Moskal,
   http://nemerle.org/~malekith/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic