You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Most single-line statements (>97%) in if/for blocks are surrounded by braces, but not all.
Expected behavior
If not contrary to the coding standard, no change is required, although consistency is always nice...
Additional context
Most safety-focused coding standards require braces in call blocks, even for single-line statements (and often even for empty statements). I'm not sure where the cFS (GSFC) standard stands on this.
This is due to the perceived improvement in readability and maintainability (i.e. with braces, there is a lower risk of messing up the scope of a statement when something is either added or removed in the future).
Describe the bug
Most single-line statements (>97%) in if/for blocks are surrounded by braces, but not all.
Expected behavior
If not contrary to the coding standard, no change is required, although consistency is always nice...
Additional context
Most safety-focused coding standards require braces in call blocks, even for single-line statements (and often even for empty statements). I'm not sure where the cFS (GSFC) standard stands on this.
This is due to the perceived improvement in readability and maintainability (i.e. with braces, there is a lower risk of messing up the scope of a statement when something is either added or removed in the future).
Code snips
CF/fsw/src/cf_cfdp_s.c
Lines 789 to 790 in b9a8898
CF/fsw/src/cf_cmd.c
Lines 596 to 597 in b9a8898
A few further examples from around cFS to illustrate:
https://github.com/nasa/MD/blob/908165343533c8288631cc5a2a1e9b87dc3fb818/fsw/src/md_utils.c#L49-L50
https://github.com/nasa/to_lab/blob/9e2ad8cccafaad6d09902213971344d9e277e9f9/fsw/src/to_lab_app.c#L216-L219
https://github.com/nasa/cFS-GroundSystem/blob/73935aca4b417c717ef6b6be03bbf5e1ad5b48f5/Subsystems/cmdUtil/cmdUtil.c#L398-L399
Reporter Info
Avi Weiss @thnkslprpt
The text was updated successfully, but these errors were encountered: