Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ut-ngp.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!ut-sally!ut-ngp!oacb2 From: oacb2@ut-ngp.UUCP (oacb2) Newsgroups: net.lang.c Subject: Re: condition convention 'if (10 == j)...' Message-ID: <1672@ut-ngp.UUCP> Date: Mon, 29-Apr-85 12:18:11 EDT Article-I.D.: ut-ngp.1672 Posted: Mon Apr 29 12:18:11 1985 Date-Received: Tue, 30-Apr-85 04:11:07 EDT References: <137@bocklin.UUCP> <> <332@cubsvax.UUCP> Organization: U.Texas Computation Center, Austin, Texas Lines: 17 > Just that instead of writing, in the traditional manner, > if(pc=malloc(nbytes)==NULL)... > you have to insert extra parens if you use the other form: > if(NULL==(pc=malloc(nbytes))).. Huh??? The first sets pc to 0 or 1 depending on whether the result of malloc is or is not NULL. The second sets pc to the result of malloc. This seems to be another argument in favor of (CONSTANT == expression). The first is probably incorrect, but legal C. I think the (CONSTANT == expression) form is ugly. That may just be that it's not very familiar (guess it's been too many years since I used APL). It does seem to have some merit though. -- Mike Rubenstein, OACB, UT Medical Branch, Galveston TX 77550