Why is null lowercase?
Rob T
alanb at ucora.com
Thu Jan 24 09:04:39 PST 2013
On Thursday, 24 January 2013 at 12:56:03 UTC, Matthew Caron wrote:
> This is probably a question for Walter, but maybe others know.
>
> Of all of the differences between C and D, the one which I have
> the most difficulty adapting to is null being lowercase. Does
> anyone know why this decision was made?
You'll get used to it, it's actually much better than typing in
NULL, and it's a real type instead on an int, which never worked
well in C.
Just be warned that when checking for null *do not* use equality
operator
if ( ptr == null) ...
instead use the identity operator "is"
if ( ptr is null) ...
for not null checks
if ( ptr !is null) ...
BTW, half of what you thought worked well in C/C++ will get
turned upside down if you stick with D, and once you get it,
moving back to C/C++ becomes unbearable.
--rt
More information about the Digitalmars-d-learn
mailing list