(no title)
time4tea | 2 months ago
Actual code i have seen with my own eyes. (Not in F-35 code)
Its a way to avoid removing an unused parameter from a method. Unused parameters are disallowed, but this is fine?
I am sceptical that these coding standards make for good code!
tialaramex|2 months ago
Notably this document is from 2005. So that's after C++ was standardized but before their second bite of that particular cherry and twenty years before its author, Bjarne Stroustrup suddenly decides after years of insisting that C++ dialects are a terrible idea and will never be endorsed by the language committee, that in fact dialects (now named "profiles") are the magic ingredient to fix the festering problems with the language.
While Laurie's video is fun, I too am sceptical about the value of style guides, which is what these are. "TABS shall be avoided" or "Letters in function names shall be lowercase" isn't because somebody's aeroplane fell out of the sky - it's due to using a style Bjarne doesn't like.
platinumrad|2 months ago
windward|2 months ago
And boiling down these guidelines to style guides is just incorrect. I've never had a 'nit: cyclomatic complexity, and uses dynamic allocation'.
writtiewrat|2 months ago
unwind|2 months ago
amluto|2 months ago
https://godbolt.org/z/zYdc9ej88
clang gets this right.
platinumrad|2 months ago
While maybe 10% of rules are sensible, these sensible rules also tend to be blindingly obvious, or at least table stakes on embedded systems (e.g. don't try to allocate on a system which probably doesn't have a full libc in the first place).
dilyevsky|2 months ago
ivanjermakov|2 months ago
bluecalm|2 months ago
Isn't it just bad design that makes both experimenting harder and for unused variables to stay in the code in the final version?
ErroneousBosh|2 months ago
It's extremely annoying until it's suddenly very useful and has prevented you doing something unintended.
y1n0|2 months ago
msla|2 months ago
time4tea|2 months ago
stefan_|2 months ago
unknown|2 months ago
[deleted]
qart|2 months ago
There are many areas of software where bureaucracy requires MISRA compliance, but that aren't really safety-critical. The code is a hot mess. There are other areas that require MISRA compliance and the domain is actually safety-critical (e.g. automotive software). Here, the saving grace is (1) low complexity of each CPU's codebase and (2) extensive testing.
To people who want actual safety, security, portability, I tell them to learn from examples set by the Linux kernel, SQLite, OpenSSL, FFMpeg, etc. Modern linters (even free ones) are actually valuable compared to MISRA compliance checkers.
[1] https://ieeexplore.ieee.org/abstract/document/4658076
[2] https://repository.tudelft.nl/record/uuid:646de5ba-eee8-4ec8...
sam_bristow|2 months ago
In my opinion, the MISRA C++ 2023 revision is a massive improvement over the 2008 edition. It was a major rethink and has a lot more generally useful guidance. Either way, you need to tailor the standards to your project. Even the MISRA standards authors agree:
"""
"""jojobas|2 months ago
unknown|2 months ago
[deleted]
jjmarr|2 months ago
MobiusHorizons|2 months ago
binary132|2 months ago
binary132|2 months ago