C Style (Was Re: == vs =)

William E. Davidsen Jr davidsen at steinmetz.ge.com
Sat Apr 23 01:20:02 AEST 1988


In article <255 at oink.UUCP> jep at oink.UUCP (James E. Prior) writes:

| Amen!, and I'll go one further
| 
|    if (var==TRUE)
| 
| is not only abominable, it can be dangerous.  var==TRUE tends to presume
| that the only valid values of var are FALSE and TRUE.  There are times
| when a var can very intentionally have a non-zero (true) value other than
| TRUE (1).  The classic kind of case of this is var=isalpha(c).  The

  If you *must* use stuff like this, at least you can write:
	if (var != FALSE)
which is more likely to work. There is only one good reason I can
determine to use code like that: some COBOL programmer wrote the style
specs for your organization.
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list