471,357 Members | 1,145 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,357 software developers and data experts.

What's the reason to use return value in parenthesis?

I've seen a lot of times using return value in parentesises -
{
....
return (true);
}

What's the reason for this? Can smb explait it?

PS: they do return predefined values, not calculated like returd (I*(d/4))
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Feb 13 '06 #1
4 3519
Michael Nemtsev wrote:
I've seen a lot of times using return value in parentesises -
{
...
return (true);
}

What's the reason for this? Can smb explait it?

PS: they do return predefined values, not calculated like returd (I*(d/4))


There's no technical reason. In some cases it can increase readability,
but that's pretty rare IMO.

Jon

Feb 13 '06 #2
Michael,

I seem to remember very old C compilers (around 1974-75) that required these
parentheses, check for instance:

http://www.lysator.liu.se/c/bwk-tutor.html

For me, there's no reason for using them today.

Regards - Octavio
"Michael Nemtsev" <Mi************@discussions.microsoft.com> escribió en el
mensaje news:1E**********************************@microsof t.com...
I've seen a lot of times using return value in parentesises -
{
...
return (true);
}

What's the reason for this? Can smb explait it?

PS: they do return predefined values, not calculated like returd
(I*(d/4))
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not
cease to be insipid." (c) Friedrich Nietzsche

Feb 13 '06 #3
Hi,

"Michael Nemtsev" <Mi************@discussions.microsoft.com> wrote in
message news:1E**********************************@microsof t.com...
I've seen a lot of times using return value in parentesises -
{
...
return (true);
}

What's the reason for this? Can smb explait it?


no reason at all, probably it's auto generated code, I frankly doubt
somebody owuld do it like that manually
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Feb 13 '06 #4
Basically, because it makes return look like a function. Note that in C
(and C++ and therefore C#), most constructs look like functions:
if(...)
while(...)
for(...)

One should note the in C/C++ there's no reason to wrap parens around the
operand of the sizeof operator -- still, most poeple do, because they think
of it as a function.
int l = sizeof long;
int i = sizeof(int);

This is noteworthy, because it C# cousin, typeof, *does* require parens,
even though there no more of a need for it then there is on sizeof or
return.
Type T = typeof(System.String);
--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
"Michael Nemtsev" <Mi************@discussions.microsoft.com> wrote in
message news:1E**********************************@microsof t.com...
I've seen a lot of times using return value in parentesises -
{
...
return (true);
}

What's the reason for this? Can smb explait it?

PS: they do return predefined values, not calculated like returd (I*(d/4)) --
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche

Feb 13 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

46 posts views Thread by Reinhold Birkenfeld | last post: by
32 posts views Thread by Mike Machuidel | last post: by
13 posts views Thread by Jason Huang | last post: by
49 posts views Thread by matty | last post: by
17 posts views Thread by zhangyue.zl | last post: by
6 posts views Thread by Daniel Rudy | last post: by
14 posts views Thread by gimme_this_gimme_that | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.