Is there a difference between these two statements inside a function?
bool returnValue = true;
// Code that does something
return(returnValue);
There is no difference.
One reason to use parenthesis would be if you wanted to evaluate an expression before returning but in your example, there would be no reason. See:
Parenthesis surrounding return values
for further discussion.
The parenthesis on the upper example are superfluous; they are effectively ignored.
It would be the same as something like...
int x = (5);
The parenthesis here are ignored as well.
Both are the same in your case.
Nope there's no difference between the two, although you can include parenthesis if it makes the expression easy to read and clear.
You're abusively slowing down the compiler!
The presence of parenthesis not only slow down the preprocessing phase, but they generate a more complicated Abstract Syntax Tree too: more memory, more computation.
From a semantic point of view ? They are exactly identical. Whether there are parenthesis or not the return
statement will fully evaluate the expression before returning it.