TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: Zack Sessions 76407,1524 (X)
from: James Jones 76257,562
date: 1990-05-30 22:33:42
subject: #4014-#C and JOoysticks

#: 4016 S3/Languages
    30-May-90  22:33:42
Sb: #4014-#C and JOoysticks
Fm: James Jones 76257,562
To: Zack Sessions 76407,1524 (X)

Trust me--although K&R in the body of K&R 1st edition always parenthesize the
expressions they use in return statements, the appendix was as near to a
standard as existed pre-X3J11, and it just says expression.  Since a
parenthesized expression is an expression, it's just as acceptable
syntactically, though some may argue on stylistic grounds one way or another.

The ANSI standard simply says expression, so neither it nor K&R *require*
parentheses.

I have no way of knowing for sure, but...I bet that the K&R 1st edition
practice (adding redundant parentheses) may have arisen under the influence of
PL/I, which *does* insist on the parentheses in RETURN statements.

After spending a long time influenced by the style of K&R 1st edition, I have
moved over to the point of view that argues that return(expression) looks too
much like a function call, so I omit those redundant parentheses. (I use
redundant parentheses freely to avoid playing more-macho-than-thou games
involving detailed knowledge of the umpteen, often counterintuitive, levels of
precedence of the various operators of C.)

There are 2 Replies.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.