Cevelop / Issues

The official issue tracker for Cevelop.
9 stars 1 forks source link

Warning "Return statement has invalid style. Return value should be surrounded by parenthesis" #117

Closed jonasstein closed 4 years ago

jonasstein commented 4 years ago

Cevelop 1.13.0-201910070714 warns about return without parenthesis:

Return statement has invalid style. Return value should be surrounded by parenthesis

I am not sure, if this warning should appear in general. Examples on https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-out-multi do not use (). It would be great, if the warning could be more specific when to use () and when not, or provide a source for additional information.

tcorbat commented 4 years ago

Hi Jonas

This is a Codan checker we inherit from Eclipse CDT. We have it disabled by default, because it is harmful to parenthesize return expressions in C++. You should only enable this check if you have a very good reason to, like nonsensical coding guidelines that are forced upon you.

To disable it, open the code analysis settings: Window -> Preferences -> C/C++ -> Code Analysis and uncheck Coding Style -> Return with parenthesis

I hope this helps. Regards Thomas