Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!harged%ti-eg.csnet@CSNET-RELAY.ARPA From: harged%ti-eg.csnet@CSNET-RELAY.ARPA (Richard_Hargrove) Newsgroups: net.lang.c Subject: if (p) ... Message-ID: <2098@brl-tgr.ARPA> Date: Sun, 13-Oct-85 13:12:47 EDT Article-I.D.: brl-tgr.2098 Posted: Sun Oct 13 13:12:47 1985 Date-Received: Tue, 15-Oct-85 05:42:11 EDT Sender: news@brl-tgr.ARPA Lines: 39 It seems to me that all the discussion about what . PTR p; /* pointer to something... */ . . if (p) { . } means, whether it is good style, &c... is overlooking something. Nowhere in K & R is the meaning of the distinguished constant NULL defined. I thought its definition was implementation dependent. It just so happens that all implementations I know of use 0 (or 0L). But nothing *requires* this. That implies to me that the above coding practice is implementation dependent, whereas if (p != NULL) ... or if (not_null (p)) ... (given some magic boolean function (or macro) that returns TRUE if p != NULL else FALSE) are implementation independent. A trivial macro #define not_null(p) ((p)) will suffice if your implementation defines NULL as 0. I won't address the stylistic problems associated with using non-boolean expressions in a boolean context, regardless of what the language "allows", but the above macro should solve any problems in this area also. regards, Richard Hargrove harged%ti-eg ================ ============