4 ms·
It's duplicitous of me to bring this up given all the other problems with this plane, but since it's a favorite topic of argument here, let's not forget the F-3
by tokenrove 12y ago
It's duplicitous of me to bring this up given all the other problems with this plane, but since it's a favorite topic of argument here, let's not forget the F-35's software is mostly developed in C++, and had been, in the past, touted as a triumph of C++ over Ada.
- Roboprog 12y agoMaybe we can put Bjarne Stroustrup into an F35 :-)
- engi_nerd 12y agoHe did some consulting work for the JSF++ specification. And he's a Dane; Denmark is a Level 3 partner in JSF but hasn't officially committed to purchasing any aircraft.
- zanethomas 12y agoOk, that's scary, I would accept C for such a job but C++ provides too many opportunities for things to go wrong in strange and difficult to find ways.
- CountSessine 12y agoAre you kidding? Accept C but reject C++? That's completely ridiculous. "Well, the scout leader's fire control computer should have returned fire at the MIG. It should have, but the C-programmed fire control software cast the void* target object to a ... well, a seagull_t object. I guess you could say that the scout leader was shot down when a seagull fired a radar-guided missile at him. That's pretty funny, right? Right?" Of course maybe I'm just wrong to want type safety of any kind.
- semi-extrinsic 12y agoLinus Torvalds once quipped (in a discussion over Git) that "even if the choice of C over C++ had no other benefits than keeping the C++ programmers out, that in itself would be a huge reason to prefer C".
- jjoonathan 12y agoWhat is the preferred way to implement generic containers in C?
- scintill76 12y agoI'm not an expert, but I was curious too and looked around. Apparently glib is pretty popular, and they just use void* (typedef'd to gpointer) for the type of items in the container: https://developer.gnome.org/glib/2.42/glib-Doubly-Linked-Lists.html#g-list-append https://developer.gnome.org/glib/2.42/glib-Doubly-Linked-Lis...
- mcguire 12y agoThere isn't. You don't do generic containers in C; you implement each specific data structure from the ground up to do specifically what you need. This is both a strength and a weakness.
- marktangotango 12y agoThis is a banal question, flame bait at that.
- nitrogen 12y agoYou can write the containers as a ".x" file, which is just C with all of the type names replaced by a macro name. Then you #include the .x file where needed, #define the type before, then #undef it after. Token pasting in the C preprocessor makes for unique names, so multiple container types can be used in the same namespace.
- CountSessine 12y agoYou don't. Go to the standards committee on bended knee and ask for another awkward addition to the language like <complex.h>.
- CountSessine 12y agoJesus, this mess just never ends. Torvalds' criticism of C++ is lazy thinking, but the schadenfreude that non-C++ developers exult in from his criticism is just plain dumb. Go back and read Torvalds' screed (here's a link http://harmful.cat-v.org/software/c++/linus http://harmful.cat-v.org/software/c++/linus). Aside from some sloppy hand-wavy arguments about how he feels icky 'trusting' standard libraries, is he actually criticizing C++? Where in that mess of half-congealed reasoning is mention of multiple-inheritance or operator overloading, or any of the other classic C++ mis-features? Torvalds is a systems-programmer and he detests the greedy-method design-as-we-implement approach to development that C++ application programmers wanted to bring to git. But, guess what? That pretty much describes application developers working in every development language in common use today. You program in Java? Chances are Torvalds thinks you're a hack unworthy of working on git or linux. Ruby? Probably even worse. Javascript? Don't make me laugh. Torvalds even refers to you - yes, you - as "some CS people".
- scintill76 12y agoIt seems like I've seen this type of C-bashing (vs. C++) recently, and I don't understand it. How is well-written modern C less type-safe than C++? I define that as something along the lines of "using the latest language specification, making judicious use of all features possible, turning on extra-strict compiler warnings and errors." To address your specific scenario, you could just as well cast a void* to seagull_t* in C++ as you can in C, can't you? I'll admit to not being totally up-to-snuff on the different casts available in C++, but IIRC C-style casting still works.
- to3m 12y agoIt's much easier to do in C, as no cast is required.
- scintill76 12y agoI didn't realize that distinction, so it's good to know. Still, as I originally assumed, I confirmed that gcc with `-Wall -Werror -std=c99` flags won't compile an initialization of a "struct seagull * " with a value of type "struct enemy * ", or passing a mismatch of those types to a function. If those would be the main reasons to use C++, I'd personally rather just use C with extra checks. But to be fair, maybe that's because I'm not very comfortable with C++, to the point that I didn't notice it checks pointer types.
- to3m 12y agoYes. In C, conversion between object pointer types requires a cast, but conversion from void pointer to object pointer does not; in C++, both conversions require a cast. Conversion from void pointer to object pointer would be very a bit annoying to warn about in general, as it's so commonly used in C. And if you always use casts, that also hide other types of error (see, e.g., http://c-faq.com/malloc/mallocnocast.html http://c-faq.com/malloc/mallocnocast.html). I'm sure there are compilers (and possibly gcc/clang can do it, too...) that will warn you about this stuff without needing you to switch to C++.
- nabla9 12y agoJOINT STRIKE FIGHTER AIR VEHICLE C++ CODING STANDARDS http://www.stroustrup.com/JSF-AV-rules.pdf http://www.stroustrup.com/JSF-AV-rules.pdf Those who don't want to use Ada are doomed to reimplement it with coding standards.
- protomyth 12y agoIt makes me think slapping a C-style skin on Ada (ala VB.Net <=> C#) would make for a killer language.
- ArkyBeagle 12y agoVery much so - I naively thought Ada was going to dominate before C++ did. I tried three times to make Ada the shop standard ( in very small shops ) but there was always something that didn't fit. It is also very strange to me that Bruce Powell Douglass' work has largely gone unlauded. As clunky as UML is, the class of tools there - beginning with ObjecTime - provide considerable value. Of course there are flaws but it nearly seems of no interest at all now.
- tormeh 12y agoAt least C and C++ have proven that programming languages do matter. Otherwise I don't think they would've done anybody any good for the last decade.