Live data from Hacker News

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

youtube.com

191–200 of 451 posts

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

#191
post #105

Earlier quoted context omitted.

Not if you use GCC. https://godbolt.org/z/zYdc9ej88 clang gets this right.

You've defined that function with an attribute saying not to ignore the returned value. Is it right to explicitly silence an explicit warning?

I want some defined way to tell the compiler that I am intentionally ignoring the result.

I encounter this when trying to do best-effort logging in a failure path. I call some function to log and error and maybe it fails. If it does, what, exactly, am I going to do about it? Log harder?

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

#192
post #156

Earlier quoted context omitted.

that has nothing to do with the F-35. Europe is wise and capable enough to develop their own platform.

While there are several comparable European alternatives, many countries put their bets on the F-35 a long time ago. It is very much a part of this discussion. I’m from one of those countries, and I can assure you a lot of people would now have preferred that we went with an EU competitor instead.

What comparable alternative is available today? None of the European companies has a production 5th generation aircraft nor the integrated sensing capabilities. This is what is driving the incredible demand despite misgivings. You can't survive in a near peer combat environment without it.

Countries are buying it because it is the only game in town for certain high-value capabilities, not because they necessarily like the implications of there being a single seller of those capabilities. For better or worse, the US has been flying these for 30 years and has 6th generation aircraft in production. Everyone else is still figuring out their first 5th generation offering.

Closing that gap is a tall order. Either way, European countries need these modern capabilities to have a capable deterrent.

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

#193

Earlier quoted context omitted.

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!

stdio.h is not what you would use in safe code.

do they use f35io.h?

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

#194
post #102

Earlier quoted context omitted.

If you have memory to spare and are using hardware with an MMU, you can remap your logical address to a different page. Linux can do this, but only for user memory.

This assumes that the operating system can run. If the memory corruption impacts the OS, then it may be impossible to recover. As the systems (and software) have become more complex, keeping these Mission Assurance best practices becomes more important, but the modern generation of developers sometimes loses sight of this. A good example of what I'm talking about is a program that I was peripherally involved with abo…

Oh, to be clear, I would not do this if I needed that degree of reliability.

Or maybe I would use an MMU but drive it with a kernel written in the old fashioned way with no allocation. It would depend on what hardware I had available and what faults I wanted to survive.

(I’m not an aerospace software developer.)

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

#195

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

As is common in hard real time code, there is no dynamic allocation during operation: allocation/deallocation from/to the free store (heap) shall not occur after initialization. This works fine when the problem is roughly constant, as it was in, say, 2005. But what do things look like in modern AI-guided drones?

What you are actually doing here is moving allocation logic from the heap allocator to your program logic.

In this way you can use pools or buffers of which you know exactly the size. But, unless your program is always using exactly the same amount of memory at all times, you now have to manage memory allocations in your pool/buffers.

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

#196
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.

Semi serious idea: A lot of people (including me) write C++ but it's basically C plus a small set of really ergonomic and useful C++ features (eg references). This should be standardised as a new language called C+

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

#198
post #19
post #14

Earlier quoted context omitted.

0 allocations after the program initializes.

Open a file in the constructor, close it in the destructor. RAII with 0 allocations.

std::vector allocated and freed on the stack will allocate an array for its int’s on the heap…

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

#199

> All if, else if constructs will contain either a final else clause or a comment indicating why a final else clause is not necessary. I actually do this as well, but in addition I log out a message like, "value was neither found nor not found. This should never happen." This is incredibly useful for debugging. When code is running at scale, nonzero probability events happen all the time, and being able to immediatel…

Same. I go one step further and create a macro _STOP which is defined as w/e your language's DebugBreak() is. And if it's really important, _CRASH (this coerces me to fix the issue immediately)

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

#200

Earlier quoted context omitted.

While there are several comparable European alternatives, many countries put their bets on the F-35 a long time ago. It is very much a part of this discussion. I’m from one of those countries, and I can assure you a lot of people would now have preferred that we went with an EU competitor instead.

What comparable alternative is available today? None of the European companies has a production 5th generation aircraft nor the integrated sensing capabilities. This is what is driving the incredible demand despite misgivings. You can't survive in a near peer combat environment without it. Countries are buying it because it is the only game in town for certain high-value capabilities, not because they necessarily lik…

> What comparable alternative is available today?

You know the answer, but I'll say it anyway. There is no comparable alternative today, and there will not be one in the near future.

Post reply on HN