more questions about efficient C code

Walter Bright bright at dataio.UUCP
Wed Jul 10 21:56:18 AEST 1985


In article <147 at mips.UUCP> mash at mips.UUCP (John Mashey) writes:
>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;

Also, when I program I think "ok, now add 3 to x". I do not think
"ok, now take x, add 3 to it and stuff it back into x". I like the
op= operators because they allow me to program the way I think.



More information about the Comp.lang.c mailing list