'idiomatic' porting of c and or c++ code that does NULL checking
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Aug 23 03:28:51 PDT 2014
On Sat, 23 Aug 2014 10:19:58 +0000
nikki via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:
don't use '==' to check for nulls. the right way is:
if (foo is null) {}
if (bar !is null) {}
'==' transforms to opEquals call (see 'operator overloading') and 'is'
not.
as for 'best practice' question -- it depends of many things. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140823/808e5673/attachment.sig>
More information about the Digitalmars-d-learn
mailing list