-
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
Improve compliance with public coding standards (and document non-compliance) #933
Comments
When it comes to coding standards like this we need to have a specific goal. For instance- does a particular rule improve readability or does it make it more platform independent or does it help avoid future breakage? There are many "public coding standards" and many differ/vary so we can't meet all of them, and some conflict with other goals.
Is this needed on constants? What is the justification?
The C precedence rules are well-defined so this is not a platform/portability concern, IMO this is purely a code readability (for humans, not machines) concern. But too many () wrapping around every single item in a multi-part expression can easily go the other way and make it much less readable to humans in the end, who will have to start counting parenthesis to figure out what goes with what. Readability is subjective at the end of the day,
The problem with CFE code and "static" items is coverage testing. While static is great for keeping private data private and avoiding namespace collisions, it also keeps it isolated from coverage test.
This is also generally a readability concern, generally shouldn't be a downside to expanding in most cases I think. The general concept of function pointers comes up from time to time - IMO this is not really practical to ban use of - it isn't inherently more dangerous than any other pointer (just points to code not data). I guess one could make the case that since its executed not just accessed as data that issues can be compounded if the pointer was bad, but on modern (MMU) systems a bad pointer is likely a segfault either way. But in a modular system design like cFE we need to use this feature, modules are loaded at runtime and dynamically bound. Even just calling the entry point of a loaded module is done via function pointer. Furthermore using function pointers as callbacks from common code patterns helps re-use the code much more effectively (think iterators, generalized search routines, etc) where it can significantly reduce code duplication, which can be a huge benefit to development time/cost and stability by not having many different similar-but-different implementations around for similar tasks, just to avoid using a function pointer. (If you can't tell I'm an advocate of function pointers, I don't know why a coding standard would deem them "evil" - they have risks but like any other pointer the benefits to modular design and code reusability can far outweigh the risks when used properly). |
|
Fix nasa#933, Remove SenderReporting from SB global
Is your feature request related to a problem? Please describe.
cFS Core has been developed and maintained utilizing internal coding standards, which isn't much help to the wider community when the question of coding standards come up. Lacking documented compliance and there's a few easy fixes that could be implemented to improve compliance.
Describe the solution you'd like
Could document compliance against public standards (JPL/power of 10/etc).
Some easy updates where we could improve compliance:
Warnings we monitor and minimize occurrences:
Areas we don't comply and debatable value:
Other non-compliances identified are analyzed and dispositioned (internally), examples:
Describe alternatives you've considered
None
Additional context
Note - marking for discussion to trigger input. Nothing "breaking" or "critical" identified.
Requester Info
Jacob Hageman - NASA/GSFC
Ping @dmknutsen
The text was updated successfully, but these errors were encountered: