Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site mips.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!whuxl!houxm!ihnp4!mhuxn!mhuxr!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!Glacier!mips!mash From: mash@mips.UUCP (John Mashey) Newsgroups: net.lang.c Subject: Re: Re: more questions about efficient C code Message-ID: <147@mips.UUCP> Date: Sat, 29-Jun-85 16:58:36 EDT Article-I.D.: mips.147 Posted: Sat Jun 29 16:58:36 1985 Date-Received: Mon, 1-Jul-85 05:47:21 EDT References: <474@crystal.UUCP> <397@umcp-cs.UUCP> <721@wlcrjs.UUCP> <665@lll-crg.ARPA> Distribution: net Organization: MIPS Computer Systems, Mountain View, CA Lines: 20 > > >> if ((fp = fopen("foo", "r") == NULL) { > > Its its not for the sake of exectution efficiency. You see it > a lot for the sake of statement efficiency. ... It is also useful for human efficiency, once you become accustomed to the idiom. Code must be read and understood by humans; less (signifcant, not {}, (), etc) tokens are generally faster, within reasonable limits. A similar example is OP= operators; i.e., x = x + 3 requires slightly longer to read than x += 3, if only because you don't have tyo check that the variables on the right and left are the same. Trivial in this case, but less so when it's long_identifier1 += 3 instead of long_identifier1 += long_identifier1 + 3; No one would claim this is a big effect, but every little bit helps, especially when it even makes life easier for the compiler. -- -john mashey UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!mash DDD: 415-960-1200 USPS: MIPS Computer Systems, 1330 Charleston Rd, Mtn View, CA 94043