Live data from Hacker News

The C++ standard for the F-35 Fighter Jet [video]

youtube.com

81–90 of 451 posts

Re: The C++ standard for the F-35 Fighter Jet [video]

#81
The same is true for the software that runs many satellites. Use of the STL is prohibited.

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.

Re: The C++ standard for the F-35 Fighter Jet [video]

#82

Earlier 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?

I work in high-scale data infrastructure. It is common practice to do no memory allocation after bootstrap. Much of the standard library is still available despite this, though there are other reasons to not use the standard containers. For example, it is common to need containers that can be paged to storage across process boundaries.

C++ is designed to make this pretty easy.

Re: The C++ standard for the F-35 Fighter Jet [video]

#83
I 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 ?

Re: The C++ standard for the F-35 Fighter Jet [video]

#84

Earlier 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"?

I know for the fact simulink generates spaghetti and spaghetti code was partially blamed for Toyotas problems. Hence the inference

See https://www.safetyresearch.net/toyota-unintended-acceleratio...

Re: The C++ standard for the F-35 Fighter Jet [video]

#85

I wonder how these compare to high frequency training standards. It seems like they'd have similar speed/reliability/predictability requirements in the critical paths.

There are at least some HFT players who actually use exceptions to avoid branches on the infrequent-but-speed-critical execution path: https://youtu.be/KHlI5NBbIPY?si=VjFs7xVN0GsectHr

Re: The C++ standard for the F-35 Fighter Jet [video]

#86
post #58
post #2

TL;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: recursion. She explains in her video. Per requirements, the stack capacity has to be statically verifiable, and not dependent on runtime input.

Re: The C++ standard for the F-35 Fighter Jet [video]

#87

Earlier 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 is also interesting that places where you would expect to have quite 'switched-on' software development practices tend to be the opposite - and the much-maligned 'codemonkeys' at 'big tech' infact tend to be pretty damn good.

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]

#89
post #83

I 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 ?

There isn't much of a conversation to be had here. For low-level systems code, exceptions introduce a bunch of issues and ugly edge cases. Error codes are cleaner, faster, and easier to reason about in this context. Pretty much all systems languages use error codes.

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]

#90

For 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

In general, are these good recommendations for building software for embedded or lower-spec devices? I don't know how to do preprocessor macros anyhow, for instance - so as i am reading this i am like "yeah, i agree..." until the no stdio.h!
Post reply on HN