Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 8/28/84; site lll-crg.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!gymble!lll-crg!brooks From: brooks@lll-crg.ARPA (Eugene D. Brooks III) Newsgroups: net.lang.c Subject: Re: Re: more questions about efficient C code Message-ID: <665@lll-crg.ARPA> Date: Thu, 27-Jun-85 22:47:10 EDT Article-I.D.: lll-crg.665 Posted: Thu Jun 27 22:47:10 1985 Date-Received: Sat, 29-Jun-85 03:27:10 EDT References: <474@crystal.UUCP> <397@umcp-cs.UUCP> <721@wlcrjs.UUCP> Distribution: net Organization: Lawrence Livermore Labs, CRG group Lines: 17 > >> if ((fp = fopen("foo", "r") == NULL) { > This example bothers me. I'm not sure what all makes up the > fopen subroutine, but the addition or subtraction of one measely > assignment statement *has* to be negligible when compared to what > goes on in fopen. Even if that code is in the innermost of inner > loops, the "optimization" will still be unnoticable. I know > it's just an example of an assignment within a boolean expression, > but I see a *lot* of programs with that same code. Are we really > gaining anything, or is it merely psychological? Its its not for the sake of exectution efficiency. You see it a lot for the sake of statement efficiency. Its the efficient and STANDARD way of saying it. Any experienced C programmer recognizes this code automatically and produces it without thinking. You have problems with it because you are not an experienced C programmer yet. You of course need to include the missint paren :-)