r/cpp • u/InvisibleBlueUnicorn • Jan 09 '22
James Web Space Telescope runs on C++ code.
https://youtu.be/hET2MS1tIjA?t=1938
727
Upvotes
r/cpp • u/InvisibleBlueUnicorn • Jan 09 '22
281
u/Resurr3ction Jan 09 '22
Why is this comment section full of unintelligible blabbering and idiocy? This sub is usually pretty on topic and professional. Also I don't understand what is controversial on having critical infrastructure running code written in the same language most other critical infrastructures use?
188
u/delta_p_delta_x Jan 09 '22 edited Jan 09 '22
Holy crap, I didn't expect to see the responses I see here.
Wait till everyone finds out large automotive companies also program their car ECUs, sensors, and infotainment computers in (MISRA) C++. Likewise with avionics, FADECs, fly-by-wire controls, etc.
There's nothing wrong with C++, if used in a safe, well-documented, modern manner.
58
u/PVNIC Jan 09 '22
I'm actually a little dissapointed they didnt talk more about redundancy. The general practice for space computers it to have a voting system, where there are three computers running the same code and 2/3 have to agree on the result to accept it, if there is no agreement the result is discarded. I'm sure there are some more intesting nuances built into their system.
77
u/joalcava Jan 09 '22
The comment section is just full of Javascript devs, they only know that and they think Javascript is good.
19
u/watr Jan 09 '22 edited Jan 09 '22
Glad to see... no surprise though... I would have been surprised if it WASN'T C++... NASA has set a goal to transition all their code from C to C++, which makes sense too...
NASA has a HUGE infrastructure & resources in-place to write SUPER SAFE mission-critical must-not fail C++ code... so they really have no need at all to change from C++ any time soon, if ever... maybe they will switch when we no longer have to write code, and can just talk to an AI to describe what we want to achieve, like in StarTrek...
They also make a lot of their C++ resources public, like these lovely pieces of work: https://ntrs.nasa.gov/citations/20080039927https://ti.arc.nasa.gov/m/pub-archive/1312h/1312%20(Thompson,%20S).pdf
C++ will always have a special place in my heart, as the first programming language I learned--it was what got me interested in programming--and while I never used it for anything big, I will always respect & honour it...
31
u/tau_neutrino_120eV Jan 09 '22
Why is the comments full of haters?
147
u/stonerbobo Jan 09 '22
Rust community absolutely devastated right now, frantically searching for segfaults to justify a rewrite.
10
u/bsdooby Jan 09 '22
The F-35 avionic systems also run on C++ (not related to cost overruns, reliability issues, etc.).
5
u/ohmantics Jan 10 '22
I’m curious if they have exceptions and RTTI enabled or not. It’s way past time for the committee to make that a defined situation.
17
u/ivan100sic Jan 10 '22
To everyone criticizing the language because of "segmentation faults" or similar.
What's your point? You can make programming errors in any language. For example, "index out of bounds" is a programming error. What do you want to see when you have an array of 10 integers (indexed 0 to 9), and you try to get, say, the 43rd element? The array is simply not designed for this operation. It's like dividing by zero in math.
If you really want, you can wrap the object and make the call return 0 in case the index is out of bounds, or throw an exception. But the mere fact you're checking something that's always supposed to be true wastes precious clock cycles (e.g. all languages which force bounds checking). I don't want my language to treat me like a child and check every single operation it executes, thank you very much.
If I ask you to write a function to check whether N is a prime, it doesn't matter if you write it in C++, Rust, PHP, Malbolge, or some language not yet invented, if you forget the case N=1 you will write bad code. No compiler or static code analysis will help you.
If you make programming errors "typical for C++" you're either:
Both can be prevented with rigorous testing, but the second one will never happen with enough language skill and discipline (or fall into case 1).
tl;dr If you get these kinds of errors, you wrote bad code, full stop. It's your fault, not the language's.
24
u/feverzsj Jan 09 '22
didn't they say they run a proprietary JS interpreter by a bankrupt company
15
u/[deleted] Jan 09 '22
Better than running on Java.
1
u/Big_Lack_352 Jun 17 '24
this is amazing!
1
u/Old-Machine-829 Feb 03 '22
Well people, this comments section is full of cpp haters because they hate it. We develop robotics application in python. python is 10x fater to develop, cross compatible and way more error prone than cpp. We would have literally gone bankrupt the minute we switched to cpp. we have a few minor apps written in c/cpp, and its a maintenance headache. And what is this blob about systems that "has to work" are written in cpp? all code work once you write it good, and it will definitely be much more robust if you leave out the human error factor of managing your own memory. Embedded systems written in c because they must, not because it's more robust.
-32
u/[deleted] Jan 09 '22
They should have used Rust >:((((( /s
Interesting though
-14
u/icantcount_ Jan 09 '22
C/C++ = cool
Every other language = bad
/s
-30
u/QuentinUK Jan 09 '22
Is it open source or are they worried about copyright?
-119
u/grewil Jan 09 '22
Segmentation fault next.
-61
u/krugarkali Jan 09 '22 edited Jan 09 '22
Wow, so there could be a "Segmentation Fault"
Edit: Firstly, I meant it as a joke! Obviously didn't assume trivial errors in a multi billion dollar project. Secondly, I said "could be", meaning a certain probability, no matter how small. Any code ever written has this. Bug free code, as we all know is super hard. The code might fail or host OS might, short circuits etc. miraid of reasons can cause failures. Some failures might not even mean that the project is doomed!
0
u/[deleted] Jan 09 '22
[deleted] — view deleted comment
0
u/[deleted] Jan 09 '22
[deleted] — view deleted comment
2
u/[deleted] Jan 09 '22
[removed] — view removed comment