On 2015-10-05 22:21, Rob Pierce wrote:
> On Mon, Oct 05, 2015 at 05:38:34PM +0059, Jason McIntyre wrote:
>> On Mon, Oct 05, 2015 at 11:50:49AM -0400, Rob Pierce wrote:
> Is it KNF compliant to have an exit() or return() at the same indentation as
> the closing function brace? For example:
> 
>       exit(1);
>       }
> 
> Or:
> 
>       return(1);
>       }

This reminds me of something I've always wondered, but never gotten
around to ask about...

Why is the return value in return statements almost always enclosed in
parantheses in the codebase?

It's not explained in style(9) as far as I know, so I guess it just
crept in over time...

Semantically parantheses are of course completely unnecessary, and in my
not so humble opinion they only adds ugliness and distraction. Also it
makes the code inconsistent, because we don't use goto (label); or
break(); or continue(); for example.

Nor do we "return();" from void functions either, for that matter...


There! I just had to get that off of my chest. I feel much better now,
thank you. :-)


Regards,

/Benny

Reply via email to