Variable names
Frank Adams
franka at mmintl.UUCP
Tue Jul 29 10:26:43 AEST 1986
In article <2248 at ihlpg.UUCP> tainter at ihlpg.UUCP writes:
> notfound : boolean;
Some programming advice, free for the asking and worth every penny: *never*
use negative names (like notfound) for boolean variables. It may save you a
boolean complement in an if statement or two, but it's confusing. If
somebody comes along later and makes a change which requires the
complementary condition in an expression, it gets *really* confusing. The
savings in the if statement is ephemeral anyhow; any decent compiler will
generate equivalent code on most architectures (and those where there is a
real difference in the ease of "branch on true" vs "branch on false" are as
likely to favor one as the other).
Frank Adams ihnp4!philabs!pwa-b!mmintl!franka
Multimate International 52 Oakland Ave North E. Hartford, CT 06108
More information about the Comp.lang.c
mailing list