Unnecessary parentheses (Was: Help: VAX C problem)

mark.e.smith marks at cbnewsl.att.com
Mon Apr 22 13:15:25 AEST 1991


In article <4003 at bruce.cs.monash.OZ.AU> mmcg at bruce.cs.monash.OZ.AU (Mike McGaughey) writes:
>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.  
>
>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 McGaughey			AARNET:	mmcg at bruce.cs.monash.oz.au

'return' isn't a function, so it makes sense not to use it as such.

However, I have upon occasion used a function 
	Return( ret_val )

where Return() is a macro that restores scope.  This can be
used as a makeshift malloc()-free() monitor, complete with lovely setjmp()-
longjmp()s.  (The setjmp() and longjmp()s are also hidden in macros.
In for a penny...)

Now if we could only get the *language* to do this for us!

Mark Smith



More information about the Comp.lang.c mailing list