The main issue is mission assurance. Using the stack or the heap means your variables aren't always at the same memory address. This can be bad if a particular memory cell has failed. If every variable has a fixed address, and one of those addresses goes bad, a patch can be loaded to move that address and the mission can continue.
The C++ standard for the F-35 Fighter Jet [video]
81–90 of 451 posts
Re: The C++ standard for the F-35 Fighter Jet [video]
#82Earlier quoted context omitted.
What does RAII have to do with any of the above?
Well if you're using the standard library then you're not really paying attention to allocations and deallocations for one. For instance, the use of std::string. So I guess I'm wondering if you work in an industry that avoids std?
C++ is designed to make this pretty easy.
Re: The C++ standard for the F-35 Fighter Jet [video]
#83what leads to better code in terms of understandability & preventing errors
Exceptions (what almost every language does) or Error codes (like Golang)
are there folks here that choose to use error codes and forgo Exceptions completely ?
Re: The C++ standard for the F-35 Fighter Jet [video]
#84Earlier quoted context omitted.
You’re joking right? That autogenerated code is generally garbage and spaghetti code. It was probably the reason for Toyotas unintended acceleration glitch.
> It was probably the reason for Toyotas unintended acceleration glitch. Do you have any evidence for "probably"?
See https://www.safetyresearch.net/toyota-unintended-acceleratio...
Re: The C++ standard for the F-35 Fighter Jet [video]
#85I wonder how these compare to high frequency training standards. It seems like they'd have similar speed/reliability/predictability requirements in the critical paths.
Re: The C++ standard for the F-35 Fighter Jet [video]
#86TL;DR - no exceptions - no recursion - no malloc()/free() in the inner-loop
At that point, why not write in C? Do they think it's C/C++ and not understand the difference? > no recursion Does this actually mean no recursion or does it just mean to limit stack use? Because processing a tree, for example, is recursive even if you use an array, for example, instead of the stack to keep track of your progress. The real trick is limiting memory consumption, which requires limiting input size.
Re: The C++ standard for the F-35 Fighter Jet [video]
#87Earlier quoted context omitted.
I've worked on a playout system for broadcast television. The software has to run for years at a time and not have any leaks, We need to send out one frame of television exactly on time, every time. It is "C++", but we also follow the same standards. Static memory allocation, no exceptions, no recursion. We don't use templates. We barely use inheritance. It's more like C with classes.
I worked on the same for many years; same deal - playout system for broadcast, years of uptime, never miss a frame. The C++ was atrocious. Home-made reference counting that was thread-dangerous, but depending on what kind of object the multi-multi-multi diamond inheritance would use, sometimes it would increment, sometimes it wouldn't. Entire objects made out of weird inheritance chains. Even the naming system was cr…
it was painful for me to accept that the most elite programmers i have ever encountered were the ones working in high frequency trading, finance, and mass-producers of 'slop' (adtech, etc.)
i still ache to work in embedded fields, in 8kB constrained environment to write perfectly correct code without a cycle wasted, but i know from (others) experience that embedded software tends to have the worst software developers and software development practices of them all.
Re: The C++ standard for the F-35 Fighter Jet [video]
#88even with 90% of c++ features banned, the language remains ~5x larger than every other programming language
Re: The C++ standard for the F-35 Fighter Jet [video]
#89I guess a bigger conversation could be had in regards to: what leads to better code in terms of understandability & preventing errors Exceptions (what almost every language does) or Error codes (like Golang) are there folks here that choose to use error codes and forgo Exceptions completely ?
In C++, which supports both, exceptions are commonly disabled at compile-time for systems code. This is pretty idiomatic, I've never worked on a C++ code base that used exceptions. On the other hand, high-level non-systems C++ code may use exceptions.
Re: The C++ standard for the F-35 Fighter Jet [video]
#90For 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