Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site phri.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!mtuxo!mtunh!mtung!mtunf!ariel!vax135!timeinc!phri!roy From: roy@phri.UUCP (Roy Smith) Newsgroups: net.lang.c Subject: Re: more questions about efficient C code Message-ID: <305@phri.UUCP> Date: Thu, 4-Jul-85 13:01:00 EDT Article-I.D.: phri.305 Posted: Thu Jul 4 13:01:00 1985 Date-Received: Sat, 6-Jul-85 09:46:30 EDT References: <474@crystal.UUCP> <397@umcp-cs.UUCP> <721@wlcrjs.UUCP>, <665@lll-crg.ARPA> <5746@utzoo.UUCP> <674@lll-crg.ARPA> Organization: Public Health Research Inst. (NY, NY) Lines: 16 > > > ... Any experienced C programmer recognizes this code > > if((fptr = fopen(filename, "r")) == NULL) Somebody mentioned economy of expression being a good thing; agreed. In this particular case the idiom is so well ingrained that I don't think twice about it. In fact, doing it any other way would require more thought. Saving a line or two of source makes it that much more likely that the entire 'phrase' will fit on your screen at one time, enhancing comprehension. About the only time I would split the assignment and the test is when the line would run off the edge of the screen otherwise. -- allegra!phri!roy (Roy Smith) System Administrator, Public Health Research Institute