Live data from Hacker News

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

youtube.com

371–380 of 451 posts

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

#371
post #365
post #321

Earlier quoted context omitted.

> If the DoD enforces the requirement for Ada, Universities, job training centers, and companies will follow DoD did enforce a requirement for Ada but universities and others did not follow. The JSF C++ guidelines were created for circumventing the DoD Ada mandate (as discussed in the video).

TL;DR Ada programmers were more expensive

Since when was expense a problem for defense spending?

In the video, the narrator also claims that Ada compilers were expensive and thus students were dissuaded from trying it out. However, in researching this comment I founds that the Gnat project has been around since the early 90s. Maybe it wasn't complete enough until much later and maybe potential students of the time weren't using GNU?

  The GNAT project started in 1992 when the United States Air Force awarded New 
  York University (NYU) a contract to build a free compiler for Ada to help 
  with the Ada 9X standardization process. The 3-million-dollar contract 
  required the use of the GNU GPL for all development, and assigned the 
  copyright to the Free Software Foundation.
https://en.wikipedia.org/wiki/GNAT

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

#372

Earlier quoted context omitted.

I've always strongly disliked this argument of not enough X programmers. If the DoD enforces the requirement for Ada, Universities, job training centers, and companies will follow. People can learn new languages. And the F35 and America's combat readiness would be in a better place today with Ada instead of C++.

No they won't. DoD is small compared to the rest of the software market. You get better quality and lower cost with COTS than with custom solutions, unless you spend a crap ton . The labor market for software's no different. Everyone likes to crap on C++ because it's (a) popular and (b) tries to make everyone happy with a ton of different paradigms built-in. But you can program nearly any system with it more scalably…

> more scalably than anything else

That's quite debatable. C++ is well known to scale poorly.

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

#373
post #250

Earlier quoted context omitted.

I remember having this argument with my professor at the school, who insisted that a function should have only one "return" clause at the very end. Even as I tried, I could not get him to explain why this would be valuable and how does this produce better code, so I'm interested on hearing your take on this?

It helps prevent bugs with state. The apple login bypass bug comes to mind. Basically, you have code in an "if" statement, and if you return early in that if statement, you might have code that you needed to run, but didnt. Forcing devs to only "return once" encourages the dev to think through any stateful code that may be left in an intermediate state. In practice, at my shop, we permit early returns for trivial thi…

> The apple login bypass bug comes to mind.

I think you're talking about this "goto fail" bug?

https://teamscale.com/blog/en/news/blog/gotofail

> In practice, at my shop, we permit early returns for trivial things

Are you also writing C or similar? If so, then this rule is relevant.

In modern languages, there are language constructs to aid the cleanup on exit, such as using(resource) {} or try {} finally {} It really does depend on if these conveniences are available or not.

For the rest of us, the opposite of "no early return" is to choose early return only sometime - in cases where results in better code, e.g. shorter, less indented and unlikely to cause issues due to failure to cleanup on exit. And avoid it where it might be problematic. In other words, to taste.

> Kent Beck, Martin Fowler, and co-authors have argued in their refactoring books that nested conditionals may be harder to understand than a certain type of flatter structure using multiple exits predicated by guard clauses. Their 2009 book flatly states that "one exit point is really not a useful rule. Clarity is the key principle: If the method is clearer with one exit point, use one exit point; otherwise don’t".

https://en.wikipedia.org/wiki/Structured_programming#Early_e...

this thinking is quite different to say, 25 years earlier than that, and IMHO the programming language constructs available play a big role.

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

#374

Earlier quoted context omitted.

The "good" rules are like "don't write off the end of an array", and the bad ones are like "no early returns" or "variable names must not be longer than 6 characters". 95% of the "good" rules are basically just longer ways of saying "don't invoke undefined behavior".

Why is "no early returns" not a good rule? I do early returns in code I write, but ONLY because everybody seems to do it. I prefer stuff to be in predictable places: variables at the top, return at the end. Simpler? Delphi/Pascal style.

Because good code checks pre conditions and returns early if they are not met.

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

#375
post #5

Do avionics in general subscribe to MISRA C/C++ or do they go even further with an additional (or different) approach?

Depends on the region. MISRA is widely adopted, and then there are the US MIL standards, ECSS for european aerospace stuff, do-178C for aviation..

DO-178c is not a coding standard, it's a process standard. Projects following DO-178c processes would adopt a coding standard as a part of the process, reviewing software deliverables adhere to those standards.

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

#376

Earlier quoted context omitted.

Yes but like a certification, that clearance is yours, not the companies. You take it with you. It lasts a good while. There are plenty of government companies that would love you if you had one. Northrop, Lockheed, Boeing, etc.

An Engineering degree and a TS is basically a guaranteed job. They might not be the flashiest FAANG jobs, but it is job security. In this downturn where people talk about being unable to find jobs for years in big cities, I look around my local area and Lockheed, BAE, Booze Allen, etc they have openings.

They always have openings so investors think theyre hiring and growing. Many ads are for fictional positions.

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

#377
post #301

Earlier quoted context omitted.

Ada and especially Spark makes it a whole lot easier to produce correct software. That doesn't mean it automatically leads to better software. The programming language is just a small piece of the puzzle. But an important one.

> Ada and especially Spark makes it a whole lot easier to produce correct software. Relative to what? There are formal verification tools for other languages. I have heard Ada/SPARK is good, but I do not know the veracity of that. And Ada companies promoting Ada have horses in the race. And Ada didn't prevent the Ada code in Ariane 5 from being a disaster. > The programming language is just a small piece of the puzzl…

Well, readability, better typesafety, less undefined behaviour. In and out parameters, named parameters. Built in concurrency.

With C++ it's just too easy to make mistakes.

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

#379

Earlier quoted context omitted.

> Many EU countries are falling over each-other to buy it They are not buying it for its capabilities though, but to please their US ally/bully which would have retaliated economically otherwise. See the very recent Swiss case were theirs pilots had chosen another aircraft (the french Rafale), only to be disavowed by their politics later on.

The pilots might have reassessed after Pakistan seemed to have shot three of them down from over 200km range. Intel failure blamed but likely many factors of which some presumably may be attributed to the planes.

Pakistan has never downed an F-35.

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

#380

Earlier quoted context omitted.

The pilots might have reassessed after Pakistan seemed to have shot three of them down from over 200km range. Intel failure blamed but likely many factors of which some presumably may be attributed to the planes.

Pakistan has never downed an F-35.

They were talking about the Rafales. But I think the comment is irrelevant anyway as the scandal happened before that iirc.
Post reply on HN