home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!psinntp!psinntp!dg-rtp!robin!goudreau
- From: goudreau@robin.rtp.dg.com (Bob Goudreau)
- Subject: Re: The Correct Way To Write C if-Statements
- Message-ID: <1992Nov6.225622.25460@dg-rtp.dg.com>
- Sender: nadmroot@dg-rtp.dg.com (nadm root login)
- Date: Fri, 6 Nov 92 22:56:22 GMT
- References: <140742@lll-winken.LLNL.GOV>
- Organization: Data General Corporation, RTP, NC
- Lines: 47
-
- In article <140742@lll-winken.LLNL.GOV> booloo@framsparc.ocf.llnl.gov (Mark Boolootian) writes:
- >
- > The Correct Way To Write C if-Statements
- > by
- > Jim Minton
-
- Oh, the hubris! So there is only One True Way to write them, eh?
-
-
- > 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? ) .
-
- What's wrong with keeping the parentheses tightly-bound to the
- contents they enclose? That is, why not stick with the following
- tried-and-true style:
-
- if (conditional_expression) ...
-
-
-
- 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) ...
-
- Anyway, if you open the explicit-testing-against-TRUE can of worms,
- where does it end? One might just as well say
-
- if (((SomeDarnThing == TRUE) == TRUE) == TRUE) ...
-
- ... and so on.
-
- ----------------------------------------------------------------------
- Bob Goudreau Data General Corporation
- goudreau@dg-rtp.dg.com 62 Alexander Drive
- +1 919 248 6231 Research Triangle Park, NC 27709, USA
-