more questions about efficient C code
Eugene D. Brooks III
brooks at lll-crg.ARPA
Fri Jun 28 12:47:10 AEST 1985
> >> 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 :-)
More information about the Comp.lang.c
mailing list