I've come across some code that surrounds the return value from a method/function in parentheses.
What does that do?
The code I saw took an image, resized it and then returned it.
- (UIImage *)resizeImage:(UIImage *)image
{
//
// some fascinating, but irrelevant, resizing code here
//
return (image);
}
At least as far as C is concerned, it makes no difference. The parens aren't necessary, but they don't change the meaning of the return statement. The grammar of the return statement is
return-statement: return expressionopt ;
and one of the productions of the expression non-terminal is a parenthesized-expression, or ( expression ).
Nothing. It is completely useless.
It overrides operator precedence, yet no operator will have a lower precedence than "return".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With