4 ms·
I'm curious for more details about the software stack used on their rockets. If they are using gcc and gdb, it sounds like everything is C. Which is a scary tho
by cpeterso 14y ago
I'm curious for more details about the software stack used on their rockets. If they are using gcc and gdb, it sounds like everything is C. Which is a scary thought. :\
- manaskarekar 14y agoFrom their Reddit AMA [1] "The rocket is all C++ The rocket and spacecraft are all C++. On the ground, we use National Instruments LabVIEW extensively." - spacexdevtty [2] [1]http://www.reddit.com/r/IAmA/comments/1853ap/we_are_spacex_software_engineers_we_launch/ http://www.reddit.com/r/IAmA/comments/1853ap/we_are_spacex_s... [2]http://www.reddit.com/r/IAmA/comments/1853ap/we_are_spacex_software_engineers_we_launch/c8bpr00 http://www.reddit.com/r/IAmA/comments/1853ap/we_are_spacex_s...
- cpeterso 14y agoThanks for the links! That was exactly what I was looking for. :)
- mbell 14y ago> it sounds like everything is C. Which is a scary thought. :\ Why is that scary?
- jacques_chester 14y agoC has a number of safety-compromising properties that require positive human effort to counteract. You can go a long way to counteracting some of these with automated toolchains. You can probably go further by using languages which simply eliminate certain classes of error and then having the same level of toolchain elaboration. That's not to say that C code can't be safe. It can absolutely be made safe. It just costs more, and any system that requires positive human effort is more likely to fail than one that doesn't.
- furyofantares 14y agoCan you name a potentially appropriate language and a class of error it eliminates that cannot be eliminated with automated toolchains in C or C++?
- jacques_chester 14y agoA common example is the incomplete case problem (currently fixed by static analysis tools, I believe, but bear with me). Suppose you have an enum: enum rocket_states { ROCKET_WAITING, ROCKET_FLYING, ROCKET_FAULT } And a switch that runs off that enum: switch ( some_rocket_state ) { ROCKET_WAITING: wait_foo(); wait_bar(); break; ROCKET_FLYING: fly_foo(); break; } } This will compile. (Or maybe it won't, I haven't cut C for some time now). But you've missed the ROCKET_FAULT case. In languages which check for case completeness, this kind of logical construction would cause a compiler failure. ML, F#, Rust etc will all complain that you haven't addressed all cases. Sometimes this or something like it is added to a code template: default: assert(false); Which is defensive code that's great for test. But not as great for rockets. Better if bad code simply can't be written. I believe static analysis tools can now pick up on missing cases, but there are still lots of reasons why C can't be as fully analysed as a language like ML, Haskell, ATS, Rust etc can be. Putting aside the obvious problem of undefined behaviour meaning you really want to push C code through multiple compilers and multiple static analysis tools, there's also the great universal escape hatch for C: direct memory access. When you can simply go in and change memory, type systems and analysis are strictly speaking no longer going to work without positive human effort to refrain from doing that. Analysis can only make guarantees under certain assumptions; introduce direct memory access and all bets are off. Yes, discipline and coding standards can also cut this down. Some analysis tools will do partial analysis of memory accesses. But it still requires positive human action. A computing system includes the humans who make it, run it and use it. Cutting down on the avenues for mistakes is a good thing.
- rachelbythebay 14y agoAssuming gcc or similar, -Wall will pick up on this. int main() { enum states { A, B, C } x = A; switch(x) { case A: break; case B: break; // C not handled on purpose } return 0; } $ g++ -Wall -Werror -o enum enum.cc cc1plus: warnings being treated as errors enum.cc: In function ‘int main()’: enum.cc:3: warning: enumeration value ‘C’ not handled in switch I like this behavior since I can deliberately leave out a default and make sure I always have every case handled explicitly.
- wyager 14y agoI would be scared if they weren't using C (or a derivative like C++). C is a highly deterministic language. It has no "features" per se. If you point to a line of C code, I can tell you with very high certainty what assembly opcode(s) it will compile to. The only thing C does that might be considered a "feature" is memory abstraction, which is kind of important for any large programming project. Now, if you're trying to advocate using Java or Python or something, you've obviously never worked on embedded software. Not only does any very-high-level language introduce much higher resource requirements, but they are also much less deterministic (which is BAD for spacecraft). Proper C code is not less stable than any very-high-level language. In fact, there is a lot less that could go wrong.
- pjmlp 14y agoActually I am really scared that they use C or C++ instead of something sane like Ada. Unless their static analysis tools just make C or C++ look like Ada.
- testbro 14y agoI wouldn't be supplied if they used MISRA [1]. It can be enforced just using static analysis too, and IIRC it's good enough for avionics used elsewhere. [1] : http://en.wikipedia.org/wiki/MISRA_C http://en.wikipedia.org/wiki/MISRA_C