Unnecessary parentheses (Was: Help: VAX C problem)

Mike McGaughey mmcg at bruce.cs.monash.OZ.AU
Sat Apr 20 16:25:36 AEST 1991


browns at iccgcc.decnet.ab.com (Stan Brown) writes:

>In article <3176 at oucsace.cs.OHIOU.EDU>, sadkins at oucsace.cs.OHIOU.EDU (Scott W. Adkins) writes:
>> When I learned C, I was taught that parens were unecessary, but it was 
>> highly recommended to use them for the same reason parens were to be used
>> with macros (i.e. #define).  I have used them ever since and have grown 
>> quite attached to them.  Anymore, the program just would not look right
>> if I leave the parens out.  Oh well :-)

>I'm afraid I don't see the analogy.  

>You use parens around an expression in a macro because you don't know
>the context of the invocation of the macro.  The expression in the 
>return statement has no such problem.

Oh, the point is just that if you stick to

    return(val)

it makes it much simpler to #define return to be a macro, if you should
ever have to do so (for instance, in printing a trace).  Not that
that's terribly useful, with a decent debugger.

Mike.
-- 
Mike McGaughey			AARNET:	mmcg at bruce.cs.monash.oz.au

"His state is kingly; thousands at his bidding speed,
 And post o'er land and ocean without rest."		- Milton.



More information about the Comp.lang.c mailing list