Live data from Hacker News

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

youtube.com

201–210 of 451 posts

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

#201
post #23

Earlier quoted context omitted.

What industry do you work in? Modern RAII practices are pretty prevalent

This is common in embedded systems, where there is limited memory and no OS to run garbage collection.

Garbage collection in C++?

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

#202
post #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)

The "standard" (typically defined in projects I'm familiar with, and as of C23, an actual standard) is "unreachable": https://en.cppreference.com/w/c/program/unreachable.html

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

#204
post #202
post #199

Earlier quoted context omitted.

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)

The "standard" (typically defined in projects I'm familiar with, and as of C23, an actual standard) is "unreachable": https://en.cppreference.com/w/c/program/unreachable.html

C++ keeps getting bigger and bigger :D

Thanks for sharing

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

#205
post #132

Earlier quoted context omitted.

A multi-inhertiance system is certainly not something somebody who "was thinking in C" would ever come up with. This sounds more like a true C++ mess.

I worked on a pure C system early in my career. They implemented multiple inheritance (a bit like Perl/Python MRO style) in pure C. It was nuts, but they didn't abuse it, so it worked OK. Also, serious question: Are they any GUI toolkits that do not use multiple inheritance? Even Java Swing uses multiple inheritance through interfaces. (I guess DotNet does something similar.) Qt has it all over the place.

The best example I can think of is the Win32 controls UI (user32/Create window/RegisterClass) in C. You likely can't read the source code for this but you can see how Wine did it or Wine alternatives (like NetBSD's PEACE runtime, now abandoned).

Actually the only toolkit that I know that sort of copied this style is Nakst's Luigi toolkit (also in C).

Neither really used inheritance and use composition with "message passing" sent to different controls.

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

#206

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!

Embedded more so than just lower-spec devices. Depends on the domain too.

stdio.h is fine in some embedded contexts, and very very not fine in others

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

#207
post #132

Earlier quoted context omitted.

A multi-inhertiance system is certainly not something somebody who "was thinking in C" would ever come up with. This sounds more like a true C++ mess.

I worked on a pure C system early in my career. They implemented multiple inheritance (a bit like Perl/Python MRO style) in pure C. It was nuts, but they didn't abuse it, so it worked OK. Also, serious question: Are they any GUI toolkits that do not use multiple inheritance? Even Java Swing uses multiple inheritance through interfaces. (I guess DotNet does something similar.) Qt has it all over the place.

GTK does not support multiple inheritance afaik.

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

#208
post #79

Earlier quoted context omitted.

Not exactly sure what your experience is, but if you work with in an -fno-exceptions codebase then you know that STL containers are not usable in that regime (with the exception of std::tuple it seems, see freestanding comment below). I would argue that the majority of use cases of the STL is for its containers. So, what exact parts of the STL do you use in your code base? Most be mostly compile time stuff (types, ty…

You can use std containers in a no-exceptions environment. Just know that if an error occurs the program will terminate.

We've banned exceptions! If any occur, we just don't catch them.

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

#209
post #88

even with 90% of c++ features banned, the language remains ~5x larger than every other programming language

Check C# 10, Python 3.14, D, Haskell,...

I don't consider C# a very large language. Most of what has been added removed boilerplate code. Swift, a much younger language, is way more complicated IMO

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

#210
post #207

Earlier quoted context omitted.

I worked on a pure C system early in my career. They implemented multiple inheritance (a bit like Perl/Python MRO style) in pure C. It was nuts, but they didn't abuse it, so it worked OK. Also, serious question: Are they any GUI toolkits that do not use multiple inheritance? Even Java Swing uses multiple inheritance through interfaces. (I guess DotNet does something similar.) Qt has it all over the place.

GTK does not support multiple inheritance afaik.

It doesn't but it definitely "implements" a single inheritance tree (with up casting/down casting) which I believe Xt toolkits (like Motif) also did.
Post reply on HN