home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!usc!rpi!psinntp!psinntp!dg-rtp!batman!goudreau
- From: goudreau@batman.rtp.dg.com (Bob Goudreau)
- Subject: Re: The Correct Way To Write C if-Statements
- Message-ID: <1992Nov12.212728.8864@dg-rtp.dg.com>
- Sender: nadmroot@dg-rtp.dg.com (nadm root login)
- Date: Thu, 12 Nov 92 21:27:28 GMT
- References: <140742@lll-winken.LLNL.GOV> <1992Nov6.225622.25460@dg-rtp.dg.com> <hansg.721510062@risken>
- Organization: Data General Corporation, RTP, NC
- Lines: 67
-
- In article <hansg.721510062@risken> hansg@risken.vd.volvo.se (Hans Granqvist) writes:
- >goudreau@robin.rtp.dg.com (Bob Goudreau) writes:
- >
- >-> if ( OpenCode ) ...
- >
- >-Is anyone else as repelled as I am by the practice of leaving the
- >-parentheses surrounded by whitespace on both sides? Not only does
- >-it violate such de-facto standards as K&R or H&S, it goes against
- >-common English usage as well ( and if you don't believe that, then
- >-tell me what's wrong with this parenthetical question? ) .
- >
- >Hmm... in my opinion, every person putting two (2) spaces at the end of
- >a sentence ('full stop'?) not only breaks a de facto Swedish standard but also
- >shows great unsolidity in his language.
-
- "Unsolidity in his language"? Whatever does that mean?
-
- Anway, if I were posting in Swedish, then perhaps I'd put only one
- space after each period. But in English, two following spaces *IS*
- the standard (look it up). And (getting back to the point), I'll
- bet that even in Swedish you don't insert gratuitous spaces between
- parentheses and the clause which they surround.
-
-
- >-Moving on to another topic...
- >
- >-> if ( SomeDarnThing == TRUE ) ...
- >
- >-If "SomeDarnThing" (amazing how the whitespace fanatic seems to hate
- >-underscores!) is a boolean variable, then what is the point of testing
- >-it against TRUE or FALSE? The following is more concise and easier
- >-to read:
- >
- >- if (some_darn_thing) ...
- >
- >
- >Aye, relating to your latest remark on coherence with common language
- >usage, is your proposed fashion more correct than the other?
-
- I don't understand this comment. The presence or absence of the
- "== TRUE" code has no connection with punctuation conventions at all.
- The thing which I find objectionable is the silly testing against
- TRUE or FALSE. Certainly the practice of using
-
- if (condition)
-
- instead of
-
- if (condition == 1) /* or == TRUE */
-
- is well established in C; look at K&R1. So why add needless
- verbiage?
-
-
- >And, then, is there the slight casuality that 'TRUE' was defined to, per
- >chance, '4711'?
-
- In which case there is the large *certainty* that the coder is an
- idiot! Anyone who defines TRUE and FALSE such that (! TRUE) isn't
- equal to FALSE or (! FALSE) isn't equal to TRUE shouldn't be coding
- in C. The only pair of values that meet both conditions is 0 for
- FALSE and 1 for TRUE.
-
- ----------------------------------------------------------------------
- Bob Goudreau Data General Corporation
- goudreau@dg-rtp.dg.com 62 Alexander Drive
- +1 919 248 6231 Research Triangle Park, NC 27709, USA
-