Unnecessary parenthesis

Wayne Mesard mesard at bbn.com
Fri Jul 8 08:12:27 AEST 1988


>From article <2550075 at hpisod2.HP.COM>, by decot at hpisod2.HP.COM (Dave Decot):
>> >	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();  */
> 

Great.  I thought the idea of HLL's was to spare the programmer the
burden of thinking like s/he was inside the machine.  
return takes an *expression*.  Are there any other statements in the
language which have unparenthesized *expressions* in their form?  That
lil old zero hanging out there by itself LOOKS INCONSISTENT.  From the
compiler's point of view return is in the set of {goto, break, continue}
but this seems an unnatural and confusing view for a programmer to hold
in his head.

>> 1) Because it looks consistent.
> 
> With what?

With the rest of the language (see above).

> Why do you want to make it easier to confuse function calls
> with statements that don't come back?
> 

Glad you asked.  Because it's consistent with the two other statements
commonly used to change the flow of control in the middle of a function:
exit() and execl().


-- 
unsigned *Wayne_Mesard();        MESARD at BBN.COM        BBN Labs, Cambridge, MA

"I am catatonic.  And the drinks are on the house."
                                                     -DB



More information about the Comp.lang.c mailing list