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!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.lang.c Subject: Re: if(p) Message-ID: <1965@brl-tgr.ARPA> Date: Mon, 7-Oct-85 19:21:18 EDT Article-I.D.: brl-tgr.1965 Posted: Mon Oct 7 19:21:18 1985 Date-Received: Wed, 9-Oct-85 06:32:18 EDT References: <1960@brl-tgr.ARPA> Organization: Ballistic Research Lab Lines: 18 > Section 9.3 Conditional statement: > if ( expression ) statement > if ( expression ) statement else statement > In both cases the expression is evaluated and if it is non-zero, ^^^^^^^^^^^^^^^^^ This implies a comparison against 0. Therefore if "expression" is a pointer, this is comparison of a pointer with 0, which is the special case previously discussed. There is no concept of "evaluates to zero" independently of "comparison with zero". > the first substatement is executed. In the second case the second > substatement is executed if the expression is 0. Don't take K&R too much as gospel. It is an excellent book, but it really did not try to specify everything to the level that a language lawyer would want. (X3J11 is trying to do that.) K&R has to be read with the attitude of extracting the "spirit" of the language from what is implied as well as from what is said.