-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrub use of () in return statements #866
Comments
HOTFIX-20200902, Fix sb unit test setup issue
Is there consensus on removing the parentheses? @astrogeco @skliper @jphickey There is ~400 instances of unnecessary parentheses surrounding the return values in the cFS codebase. From what I can tell no modern C/C++ coding standards require, or even prefer, parentheses around return values (e.g. MISRA, JSF, JPL, ESA etc.). I'm happy to work on this but wanted to confirm if it's agreed upon first :-) |
@dmknutsen - your call. Simple style/consistency thing but could impact many repos. Looks like a simple sed one-liner or similar to fix? |
Would be nice to make it consistent + looks pretty straightforward to implement. I would recommend removing the unnecessary parentheses surrounding the return values...simply because there are so many less instances compared to return statements that do not use parentheses. |
OK Thanks Jake/Dan. |
For now, I will update only the return statements that return a single value/term like the one Jake linked to above. I will leave the complex statements as is, even though they are logically unnecessary as well. For example: osal/src/os/shared/src/osapi-time.c Lines 206 to 210 in 38559d4
I know some people prefer parentheses in these cases to make the arithmetical logic easier to break down in their head. Happy to update the rest in future if it's considered prudent. |
Fix #866, Remove unnecessary parentheses around return values.
Is your feature request related to a problem? Please describe.
Inconsistent use of (), style. Example below but should fix all.
osal/src/os/portable/os-impl-no-symtab.c
Lines 50 to 60 in ead5723
Describe the solution you'd like
Fix.
Describe alternatives you've considered
Leave as-is (future work)
Additional context
None
Requester Info
Jacob Hageman - NASA/GSFC, OSAL code review
The text was updated successfully, but these errors were encountered: