Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!nosc!ucsd!ucsdhub!hp-sdd!hplabs!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.lang.c Subject: Re: Unnecessary parenthesis Message-ID: <2550075@hpisod2.HP.COM> Date: 7 Jul 88 02:31:16 GMT References: <326@marob.MASA.COM> Organization: Hewlett Packard, Cupertino Lines: 42 > > return 0; /* intuitive */ > > To a FORTRAN programmer. And to a C programmer. Return is a statement that modifies the default flow of control, such as: goto label; /* NOT goto(label); */ break; /* NOT break(); */ continue; /* NOT continue(); */ Return is not a function call, and it shouldn't look like one. > > return(0); /* one wonders why the () are there */ > > 1) Because it looks consistent. With what? Why do you want to make it easier to confuse function calls with statements that don't come back? > 2) It's intuitive to a converted Pascal or PL/I programmer. Why? Ordinary Pascal has no return statement. > 3) The programmer has gotten used to putting parentheses around just about > everything. That may be true in your case, but it's a bug in the language design. Parentheses are overloaded for all of the following distinct purposes: function calls if, while, and do-while statements casts type construction (used both to indicate functions and for grouping) function declarations evaluation order grouping I see no reason to add further confusion by making flow control look like a function call. I use "return e;" because it's less cluttered and more distinct. Dave Decot hpda!decot