News for hackers. Stuff that matters.
Re:Going Beyond Ada 2022 by roystonvassey on Wednesday June 23, 2021 @05:41AM (#27602589)
Wow, my first “real world” programming language. Heavily used in critical systems software. Our company worked on aircraft controls and Ada was pretty much the only one “approved” by the regulators as I understood it back then. Anyone working on it currently can speak to if it’s still widely used and what this change means for Ada?
Re:Going Beyond Ada 2022 by ChuckNorris89 on Wednesday June 23, 2021 @05:44AM (#27602606)
Didn't the F-35 move to C++? I guess any future projects will follow suit.
Re:Going Beyond Ada 2022 by Nokinside on Wednesday June 23, 2021 @06:28AM (#27602862)
Yes.

C/C++ is used over Ada just for familiar syntax. The coding standards used for safety-critical projects limit the features into a tiny safe subset, Essentially DSL. Linters and code checkers and static analyzers check the code more thoroughly than the compiler does.

For example, all memory is allocated during initialization. No allocation or reallocation from the heap afterward. That's why you see in the weapon specs familiar magic numbers like can track 256 targets simultaneously.

Commerical code analyzers used in the military, aviation, etc. are good but expensive. I have used https://www.absint.com/astree/index.htm

JOINT STRIKE FIGHTER AIR VEHICLE C++ CODING STANDARDS FOR THE SYSTEM DEVELOPMENT AND DEMONSTRATION PROGRAMDocument Number2RDU00001 Rev C December 2005 https://www.stroustrup.com/JSF-AV-rules.pdf

Re:Going Beyond Ada 2022 by zurn on Wednesday June 23, 2021 @07:26AM (#27603205)
Ada and C++ are worlds apart, how is it possible to come so close as to be "just syntax" with static analyzers and their known limitations? Unless we are talking about all programming languages being "just syntax" for a turing machine...
Re:Going Beyond Ada 2022 by Nokinside on Wednesday June 23, 2021 @09:03AM (#27604055)
> Ada and C++ are worlds apart,

Yes. But as I said, programmers use just tiny subset of the language. Subsets are with additional checks are semantically very similar. Very dumped down code.

> being "just syntax" for a turing machine..

If you insist, I would describe them as intermediate representations for the back-ends for a non-Turing equivalent language (after all semantic checking).

Compilers parse text, check it matches the syntax, do some semantic checks, and then output native code (unless they transpile). When you write safety-critical code you can buy tools that make more far more checks to the semantics than the compiler and prevent the use of some constructs. Ada has SPARK that is integrated better.

For example, the tool I mention can prove that if code has no run-time errors or divisions by zero. It's essentially non-Turing equivalent language.

I would prefer Ada/Spark over C, but it don't matter that much, so I have always used C with tooling.

Re:Going Beyond Ada 2022 by cmrdporcupine on Wednesday June 23, 2021 @09:04AM (#27604062)
Static analyzers have come a long long way in the last 10 years.

I don't know what they've done, but you could get a long way just by forbidding all dynamic allocation.

Re:Going Beyond Ada 2022 by pyuser583 on Wednesday June 23, 2021 @10:10AM (#27604754)
Could expand on this? I’ve heard it a lot. What advances have happened?
Re:Going Beyond Ada 2022 by OnlyOneCannolo on Wednesday June 23, 2021 @08:56AM (#27603969)
I think they're saying that the switch was justified because the workforce is no longer familiar with Ada.
Re:Going Beyond Ada 2022 by Jtsummers on Wednesday June 23, 2021 @09:28AM (#27604320)
More importantly the workforce is familiar with C/C++, how it’s listed on so many job listings. Which is kind of sad as a requirement. A programmer who can’t become productive with Ada after a few weeks (productive, not masterful) is not the kind of programmer anyone should be hiring for any job. The syntax is (almost) dead simple, for a reason.
Re:Going Beyond Ada 2022 by OnlyOneCannolo on Wednesday June 23, 2021 @10:09AM (#27604735)
Edit: Retracting my whole comment for being wrong.
Re:Going Beyond Ada 2022 by Jtsummers on Wednesday June 23, 2021 @10:20AM (#27604846)
Those jobs require competence from most contributors. Mastery from a few. And you can teach mastery to non-incompetent people, most of the time. Also, most jobs that Ada would be used for aren't time critical (in the sense of "Oh god oh god oh god we've got to ship yesterday!", unless it's F-35, which fortunately didn't use Ada because that would've saved them a lot of heartache). They program in 2-5 years for the project so 1 month to competency and then additional OJT from more experienced (with Ada and the system) over the rest of the time will produce mastery.
Re:Going Beyond Ada 2022 by OnlyOneCannolo on Wednesday June 23, 2021 @10:26AM (#27604914)
True. I take back what I wrote for being too reductive. Well said.
Re:Going Beyond Ada 2022 by jnwatson on Wednesday June 23, 2021 @10:38AM (#27605058)
I would doubt there are enough masters of C++ to fill an airplane.
Re:Going Beyond Ada 2022 by ajxs on Sunday June 27, 2021 @08:11PM (#27656700)
Here's a very telling quote regarding the choice of programming language from a software team manager from the JSF project:

"Ada was seen as the technically superior and more robust language, but concern over the ability to successfully staff the software engineers required to develop the massive amounts of safety critical software caused the F-35 team to carefully look and finally to choose C and C++ for the implementation of safety critical software." - John H. Robb, Senior Manager of the F-35 Joint Strike Fighter Air Vehicle Software team at Lockheed Martin Aeronautics Fort Worth[1]

[1]https://web.archive.org/web/20111219004314/http://journal.th...

Re:Going Beyond Ada 2022 by Raphael_Amiard on Thursday June 24, 2021 @07:09AM (#27616027)
As said in another comment, that's completely and demonstrably false.

As soon as a coding standard for C/C++ doesn't completely forbid the use of pointers (which is completely impossible at least in C), then it will be much more unsafe than Ada (or other alternatives like Rust).

You can have - very painfully - near pointer free programming in C++, but it requires the use of high level constructs (smart pointers, RAII, etc) that most if not all safety critical standards forbid the use of.

Some people like the Frama-C people are trying to make programming in - a restricted an enhanced subset of - C, safe. They're basically doing Ada/SPARK with annotations in C, and it's horribly painful.

So, despite its informed and documented appearances, your comments are spreading misinformation about what it's like to program in C/C++ for safety critical systems.

Re:Going Beyond Ada 2022 by Nokinside on Thursday June 24, 2021 @05:13PM (#27623838)
Astrée static analysis tool detects invalid pointer dereferences. It can give false alarms but it always detects errors. It does this buy using abstract interpretation on the semantics. It's essentially partial execution.
Re:Going Beyond Ada 2022 by bottled_poe on Wednesday June 23, 2021 @06:00AM (#27602693)
I really hope that’s inaccurate. As much as I love programming in c++, I find it very hard to believe that the same number of nines can be achieved as Ada for similar budget.
Re:Going Beyond Ada 2022 by Nokinside on Wednesday June 23, 2021 @06:32AM (#27602889)
See my other comment.

C/C++ is used over Ada just for familiar syntax. From a safety perspective, the choice of language is inconsequential. With C/C++ the code analyzers used must do more work than with Ada but not that much.

All safety-critical code uses just a tiny subset of the language. It's like programming in a different language. Line-by-line coder reviews are a must.

Re:Going Beyond Ada 2022 by Raphael_Amiard on Thursday June 24, 2021 @06:57AM (#27615964)
> C/C++ is used over Ada just for familiar syntax. From a safety perspective, the choice of language is inconsequential. With C/C++ the code analyzers used must do more work than with Ada but not that much.

That is completely and utterly false despite the millions (billions ?) invested in trying to make sound & safe static analysis tools for C/C++. I know you're trying to push that message but it couldn't be further from the truth. The nature of C & C++ is such that you cannot avoid unsafety, even with very restricted subsets.

Disclaimer: I work on Ada tools, but have also worked on C/C++ tools. I have also studied MISRA C and worked on such static analyzers for C & C++.

Re:Going Beyond Ada 2022 by Nokinside on Thursday June 24, 2021 @05:06PM (#27623757)
Re:Going Beyond Ada 2022 by MaxBarraclough on Wednesday June 23, 2021 @01:31PM (#27607313)
> From a safety perspective, the choice of language is inconsequential.

Citation very much needed. Some safety-critical projects choose to use Ada over C or C++, despite that there are far fewer Ada programmers out there, and that there are fewer development tools for Ada. The people running those projects presumably disagree with you.

We know that the choice of language is very consequential regarding cybersecurity. The many foot-guns of C and C++ are the root of a significant fraction of security vulnerabilities. Saying that these same foot-guns are of no consequence in safety-critical software seems like a remarkable claim.

This document [0] explicitly disagrees with your position that language is of little consequence. (Not to gloss over that it appears to have been funded by AdaCore, who are of course motivated to reach that conclusion.)

[0] See especially page 12: (PDF) https://www.adacore.com/uploads/techPapers/Controlling-Costs...

Re:Going Beyond Ada 2022 by pjmlp on Wednesday June 23, 2021 @07:39AM (#27603288)
I guess Toyota forgot to get those line-by-line coder reviews.

https://users.ece.cmu.edu/~koopman/pubs/koopman14_toyota_ua_...

Re:Going Beyond Ada 2022 by erikw on Wednesday June 23, 2021 @08:27AM (#27603644)
The linked PDF doesn't seem to mention anything related specifically to C++. It says that it is possible for bit flips to affect software. They then suggest that Toyota should have used the following practices:

• “Near-perfect” software

• Design out single points of failure

• Justify real time scheduling with analysis

• Watchdog timers that have real “bite”

• Good software architecture

• Good safety culture

This seems like mostly good concrete advice, although I think we can all agree that simply creating "near-perfect software" is a goal, not a solution. If you read up on Toyota's unintended breaking legal issues, it appears that it was most likely driver error, as Toyota did not issue a firmware change to the affected vehicles, and no software problems were ever identified.

Re:Going Beyond Ada 2022 by caslon on Wednesday June 23, 2021 @06:11AM (#27602768)
Oh don't worry, the F-35 is already a twisted vanity project of the military industrial complex largely created to siphon off as many percentage points of the US budget as possible. The goal is not nines, it's getting more executives out on the field to play Nines*.

* Niche golf game.

Re:Going Beyond Ada 2022 by pjmlp on Wednesday June 23, 2021 @06:03AM (#27602708)
You mean the highly successful and timely delivered F-35 project?
Re:Going Beyond Ada 2022 by p_l on Wednesday June 23, 2021 @06:37AM (#27602920)
A non-trivial part of the problems is related to non-flying software, ALIS (now renamed ODIN, when the contract to redo it was awarded to the same people who fucked it up first).

Knowing Lockheed-Martin, it's horrible mess of Java and JavaScript gathered from random geocities pages in 1990s.

Re:Going Beyond Ada 2022 by trhway on Wednesday June 23, 2021 @07:22AM (#27603177)
>Knowing Lockheed-Martin, it's horrible mess of Java and JavaScript gathered from random geocities pages in 1990s

well, it fits that the F-35 started as a horrible mess of JSF requirements bolted on top of Yak-141 from 1980s :)

Re:Going Beyond Ada 2022 by protomyth on Wednesday June 23, 2021 @07:33AM (#27603249)
If I remember correctly the F-22 is Ada and the F-35 is C++.
Re:Going Beyond Ada 2022 by WoodenChair on Wednesday June 23, 2021 @11:18AM (#27605513)
Probably a good analogy for the languages too. One tries to do one thing well, the other tries be all things to all users and does them all mediocrely.