c - Parenthesis surrounding return values -


quite in ansi c code can see parenthesis sorrounding single return value.

like this:-

int foo(int x) {   if (x)     return (-1);   else     return (0); } 

why use () around return value in cases? ideas? can see no reason that.

there isn't reason...it's old convention.

to save space, programmers final math in return line instead of on it's own line , parens ensure there make easier see single statement returned, this:

return (x+i*2); 

instead of

int y = x+i*2; return y; 

the parenthesis became habit , stuck.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -