Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.lang.c Subject: Re: Unnecessary parenthesis Summary: we use em' Message-ID: <461@proxftl.UUCP> Date: 13 Jul 88 03:25:48 GMT References: <326@marob.MASA.COM> <2550075@hpisod2.HP.COM> <5253@ihlpf.ATT.COM> <8108@elsie.UUCP> Organization: Proximity Technology, Ft. Lauderdale Lines: 36 In article <8108@elsie.UUCP>, ado@elsie.UUCP (Arthur David Olson) writes: > I leave out the parentheses in a > return whatever; > statement; this ensures that if I mistakenly write > retunr whatever; > I'll get a warning at compile time--along with a line number--rather than > an "Undefined: _retunr" error at link time (with no indication of where the > error is) as would be true if I wrote > retunr(whatever); > (which the compiler would take to be a function call.) This is the first non-esthetic reason I've seen for not putting in the parentheses; I'd note that it does not always work, consider: retunr (a+b)*c;. Oh, well, nobody said programming was going to be trivial... Just to add some data to the discussion, here is what we do. o No function call has a space after the function descriptor. o Every keyword except sizeof is always followed by a space, newline, or semicolon. o Sizeof is always formatted as if it were a function call. Actually, we code no space after the sizeof because it is a unary operator and we parenthesize for uniformity; this makes it look like a function call. o For purely Hysterical Raisons we always use parentheses around the expression. I think we'd change except for inertia and the pain of reformatting all the code of a new version of a product. My own opinion on the use of parentheses is that almost any consistent style is better than no style at all. The differences between most styles is a matter of esthetics; one may choose almost any style one pleases and be "right".