I have seen both in the C and C++ code I have been looking at.
What is the difference?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No difference at all.
The official syntax is
return something;orreturn;and of course it is a keyword, not a function.For this reason you should not read it as
return( a );but asreturn (a);I think the difference is subtle but clear, parentheses will not apply to return but to a.
((((a))))is the same as(a)that is the same asa.You can also write something like…
You can also write something like…
As someone said in the comments, there is now, with C++11 (2011 version of the C++ language) the new operator
decltype. This operator introduces a new example where(a)is different froma, this is quite esoteric and a little out of topic but I add this example just for the purpose of completeness.Students will not be interested in this, as I said, too esoteric, and it will work only with compilers that supports at least part of the C++11 standard (like GCC 4.5+ and Visual Studio 2010).
This goes in contrast also with the use of
typeidkeyword: