Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

C++ is used in avionics.


sort by: page size:

C++ may not be the best choice, but a language like Haskell would be worse for an aviation application for a number of reasons:

1) Memory on the hardware is tightly constrained and controlled, and you need some visibility into its usage at any given time. Even if it exposes you to null pointer errors and the like.

2) Along the same lines, throughput must be predictable and is tightly constrained. Anything happening at runtime that can't be predicted at compile time is, for a safety critical aviation application, a huge risk and is usually explicitly forbidden by the requirements.

3) Haskell is relatively new. C++ has stood the test of time and the DoD can be sure plenty of C++ programmers will still be around in 30+ years.

All of these are dealbreakers from the DoD's perspective. The technical risks associated with handling your own memory and not having provably safe code can be addressed with enough time and expense. Since the DoD is not short on money and operates on time scales of years or decades, this is acceptable. In a startup or academic environment, the balance of risks and resources is completely different. But believe it or not, the DoD and commercial aviation entities actually do look at the tradeoffs associated with the tools they choose and don't simply choose them out of inertia.

Source: I develop commercial jet engine software, where many of the same resource/risk tradeoffs exist.


Anything in embedded systems. I write code for high performance satellite terminal (ground side) and also point-to-point radio systems (ultra-low latency, millimetre wave stuff). 90% of the code I write is in C, about 60% of the time on microcontrollers with <256KB of RAM, and the rest in a cut-down Linux running on an ARM Cortex A8.

I'd actually prefer to use C++ for the Linux stuff (std::string, smart pointers and STL containers would save me so much time), but we don't have the C++ standard library in our custom distro.


Still, C++ is very useful on embedded systems. This article is just about that.

C++ is safe and effective.

They have stuff like bit manipulations and the likes, C++ makes sense for those.

Yeah, but the slides don't give a reason why; the only hint is a prior slide mentioning the "historic arguments against using C++ in flight", namely "Exceptions: too much uncertainty, difficult to validate all possible control paths". And that has nothing to do with performance.

C++ is still the choice for truly performance-critical applications, period.

C++ is a more efficient language to write difficult to track down bugs in than Fortran.

C++ can be used instead of Blueprints.

C++ used for graphics also.

I'm super curious why C++ was chosen when the risks are so high. Performance?

Not sure, but I believe the performance-critical components are C++.

c++ does a good job

Or, C++ gives you speed and low-level control at the cost of some extra complexity.

C/C++ is a potential footgun, but it has its place for applications where they need precise control.

Large parts are written in C++ :)

C++ also has modules.

Agree. There is a lot to be gained from using C++ with absolutely no or imperceptible overhead.

I guess the only common embedded systems I would think twice before using C++ nowadays is 8051 and the very low end AVR/PIC (which can have as little as 32 bytes of RAM).


C++ gives you fine grained control over the machine, which is something these fields often need (I am in the computer vision/AI segment). When you are using Intel Intrinsics, MKL, etc., just to get enough performance to barely do the job, you can't afford to throw that control away to garbage collection, reference counting, and all that. I use higher level languages for the things they are great for - the 'batteries included' features of Python, for example, or the functional+high availability of Erlang. And they are great languages for what they are designed to be used for.

Not every C/C++ programmer (I say with considerable understatement) is an obsolete, corporate hack unaware of the state of the art in computer languages and tools. We wrote your compilers, your languages, your VMs, your toolsets, your OS, your math libraries, your, well, you get the idea :)

next

Legal | privacy