Are parentheses around the result significant in a return statement?

前端 未结 11 2379
感情败类
感情败类 2020-11-27 12:07

Is there a difference between these two statements inside a function?

bool returnValue = true;
// Code that does something
return(returnValue);
11条回答
  •  不知归路
    2020-11-27 12:41

    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.

提交回复
热议问题