if(p)
Mike Woods
mike at rlvd.UUCP
Thu Sep 26 21:28:26 AEST 1985
Followup-To:
Xpath: warwick ubu
In article <1671 at brl-tgr.ARPA> ART at ACC.ARPA (Art Berggreen) writes:
>From an abstract language viewpoint, an "if" statement conditionally
>executes a block of statements based on whether the control statement
>evaluates to a condition of *TRUE*. Pointers by themself do not
>have attributes of TRUE vs FALSE. Thus, "if(pointer)" makes less semantic
>sense than "if(pointer == SOME_VALID_POINTER_VALUE)". What to test against
>has been discussed in previous messages.
But from an abstract viewpoint, pointers can be considered to have
two states: valid or invalid. Therefore, "if (pointer)" can be read
as "if (pointer is valid)". At least this is how I look upon such
things (though the first time I saw it my mind stopped functioning
for five minutes (the legacy of Fortran!)).
Mike (I don't think logically; I think C) Woods.
--
UK JANET: mike at uk.ac.rl.vd
UUCP: ..!mcvax!ukc!rlvd!mike
More information about the Comp.lang.c
mailing list