Do avionics in general subscribe to MISRA C/C++ or do they go even further with an additional (or different) approach?
Depends on the company in my experience. I've seen some suppliers that basically just wire up the diagram in Matlab/simulink and hit Autocode. No humans actually touch the C that comes out. Honestly I think that's probably the correct way to write high reliability code.
The C++ standard for the F-35 Fighter Jet [video]
31–40 of 451 posts
Re: The C++ standard for the F-35 Fighter Jet [video]
#32Re: The C++ standard for the F-35 Fighter Jet [video]
#33Re: The C++ standard for the F-35 Fighter Jet [video]
#34Re: The C++ standard for the F-35 Fighter Jet [video]
#35Earlier quoted context omitted.
That’s hardly 90% of C++.
If you compile with -fno-exceptions you just lost almost all of the STL. You can compile with exceptions enabled, use the STL, but strictly enforce no allocations after initialization. It depends on how strict is the spec you are trying to hit.
Re: The C++ standard for the F-35 Fighter Jet [video]
#36For those interested, the F-35 (née Joint Strike Fighter) C++ coding standards can be found here, all 142 pages of it: https://www.stroustrup.com/JSF-AV-rules.pdf
Re: The C++ standard for the F-35 Fighter Jet [video]
#37Earlier quoted context omitted.
That’s hardly 90% of C++.
If you compile with -fno-exceptions you just lost almost all of the STL. You can compile with exceptions enabled, use the STL, but strictly enforce no allocations after initialization. It depends on how strict is the spec you are trying to hit.
Re: The C++ standard for the F-35 Fighter Jet [video]
#38Re: The C++ standard for the F-35 Fighter Jet [video]
#39Earlier quoted context omitted.
If you compile with -fno-exceptions you just lost almost all of the STL. You can compile with exceptions enabled, use the STL, but strictly enforce no allocations after initialization. It depends on how strict is the spec you are trying to hit.
Not my experience. I work with a -fno-exceptions codebase. Still quite a lot of std left. (Exceptions come with a surprisingly hefty binary size cost.)
Re: The C++ standard for the F-35 Fighter Jet [video]
#40TL;DR - no exceptions - no recursion - no malloc()/free() in the inner-loop
Forbidding recursion is pretty annoying. One of the nice things that's on the distant horizon for Rust is an explicit tail recursion operator perhaps named `become`. Unlike naive recursion, which as this video (I haven't followed the link but I'm assuming it is Laurie's recent video) explains risks stack overflow, optimized tail recursion doesn't grow the stack. The idea of `become` is to signal "I believe this can b…
But ... that rewrite can increase the cyclomatic complexity of the code on which they have some hard limits, so perhaps that's why it isn't allowed? And the stack overflow, of course.