🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3675

Re: Parenthesis with return ?

#3675
From: Keith Thompson
Date: Mon, 07 Aug 1995 23:02
31 lines
2084 bytes
In <405kro$8rv@elf.bsdi.com> torek@elf.bsdi.com (Chris Torek) writes:
> Early C compilers required these parentheses.  PCC, which appeared
> in Phototypesetter V6, did not.  Whether Dennis's compiler still
> required them when the White Book was first written I do not know,
> but they appeared in all the examples.  I cannot find the revised
> `ANSI C' edition of K&R to see whether they have removed them since
> then.

All the examples in the first edition of K&R do use parentheses on the
return expressions, but the description in the C Reference Manual at
the end of the book makes it clear that the parentheses are optional
(see page 203).  To be more precise, the parentheses are not part of
the syntax of the return statement, but the expression can of course
be a parenthesized one.

The examples in the second edition of K&R do not use parentheses on
return expressions.

My own strong preference for C (and other languages with similar syntax
for return statements) is *not* to use extra parentheses.  A return
statement is not a function call, and should not look like one.

To return to the topic of this newsgroup for just a moment, if any future
C standard required parentheses on return statements, it would break a
lot of existing code for no good reason.

-- 
Keith Thompson (The_Other_Keith)  kst@thomsoft.com (kst@alsys.com still works)
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
Because I'm weird enough, I'm sick enough, and doggone it, people fear me!
Technical Details
Message-ID: <DCyqoL.8KJ@thomsoft.com>
Path: arc1-ca.pugleaf.net!pacbell.com!tandem!telesoft!kst
References: <405fhs$iin@boson.epita.fr> <DCy9uG.CEr@proteon.com> <405kro$8rv@elf.bsdi.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!pacbell.com!tandem!telesoft!kst
From: kst@thomsoft.com (Keith Thompson)
Subject: Re: Parenthesis with return ?
X-Nntp-Posting-Host: pulsar
Message-ID: <DCyqoL.8KJ@thomsoft.com>
Originator: kst@pulsar
Sender: news@thomsoft.com (USENET News Admin @flash)
Organization: Thomson Software Products, San Diego, CA, USA
References: <405fhs$iin@boson.epita.fr> <DCy9uG.CEr@proteon.com> <405kro$8rv@elf.bsdi.com>
Date: Mon, 7 Aug 1995 23:02:45 GMT