A list of systems, applications, and libraries that are written in C++
stroustrup.com
stroustrup.com
There's also the standard halo effect listing. Any sufficiently large company is using a language / methodology / philosophy / technology you've heard about. And they're being namechecked on that language / methodology / philosophy / technology's website.
The classic is Microsoft.
Did you know Microsoft uses Scrum? They do!
Did you know Microsoft uses ISO 9295-424:54 (Humungo Software Dev Standard Written by the SEI, the DoD and a committee of 200 researchers from different Fortune 50 companies)? They do!
(Hint: Microsoft doesn't have a single unified method of development, it's largely up to each section to decide how they do the work)
Found a reference: "Creating a driver on BeOS is done using ANSI C; the C++ language requires certain support which is not available in the BeOS kernel environment." http://testou.free.fr/www.beatjapan.org/mirror/www.be.com/ab...
I remember another newsletter article where one of the devs described techniques for getting C++-like power while remaining within C (heavy use of function pointers in structs, that kind of thing).
Another: http://www.haiku-os.org/legacy-docs/benewsletter/Issue4-51.h...
http://en.wikipedia.org/wiki/Fragile_binary_interface_proble...
I wonder how modern C++ frameworks are handling this?
> TCharStreamCFString::~TCharStreamCFString() + 37 (CoreText) [0x7fff9454b091]
> JSC::BlockAllocator::blockFreeingThreadMain() + 90 (JavaScriptCore) [0x7fff950fad0a]
> CA::Render::Server::server_thread(void) + 403 (QuartzCore) [0x7fff8c6e435b]
> TFSInfo::FetchProperties() + 1274 (DesktopServicesPriv) [0x7fff93a7da20]
> 0x000000010b50afca ld::tool::InputFiles::forEachInitialAtom(ld::File::AtomHandler&) + 410
Same on iOS...
> CoreMotion 0x043d60a2 CLMotionCore::runMotionThread(void) + 1016
I think I even saw a core part of NSAutoreleasePool in there once. I have never read the public Apple source tarballs, but from just seeing stack traces every now and then, it seems as if Apple is very happy with using both Objective C and C++ (the compiler makes this easy of course - e.g. C blocks have support for C++ construction/destruction etc...).
https://dev.mysql.com/doc/internals/en/general-development-g...
And everyone knew the huge amount of software in C++. Why the list?
Perhaps the submitter just likes watching HN'ers fall all over themselves to reflexively point out all the reasons why C++ is, like, the worst language ever? (Someone even mentioned coding Windows in ML-derived languages, I can only imagine Raymond Chen's reaction to that)
[1]: https://github.com/bloomberg/bsl [2]: https://github.com/bloomberg/bsl/wiki/bdestds.pdf
If we get to the point where OS distros want to package the libs, we may opt to generate autotools files, but that was too much work to be a roadblock from open-sourcing the lib.
Another interesting C++ coding guideline are the JSF coding guidelines. Stroustrup was actually involved in creating them. It's mostly focused in embedded and critical systems. But unlike what most people expect they highly recommend stuff like Templates
Like anything boost spirit has a leaning curve. You could just as easily say no one should use emacs because it is hard to learn. In fact I personally don't use emacs because I found it too hard to get going with, but I don't from there extrapolate that no one else should use it.
The compile time and binary size problems of boost spirit can be addressed by factoring your grammar into smaller subgrammars in separate compilation units. The subgrammars can still be combined the same as rules can be.
The obscure error messages can be improved by using typeful programming so that you get an error like "no conversion from MyRuleADatatype to MyRuleBDatatype".
Yes these things are still problematic, but how do we get from "X is hard" to "no one should use X"? See the Clojure author's talk on Simple vs Easy: he lambasts programmer culture for being obsessed with 'easy' to the detriment of creating useful stuff. He asks, what if the Foo Fighters said guitars are hard to play, let's play kazoos because they are easy. Would you listen to the Kazoo Fighters, he asks.
You can ignore the more restrictive rules (for embedded systems) if that's your case.
I have some familiarity with some of the systems described (and with other systems that use C++). Let me put it this way:
- Large enterprise projects are bad
- Large enterprise projects in C++ are very bad. It's like giving razor blades to a kindergarten group for a whole afternoon. I wish I was kidding
- "Done in C++" is not as important as the capabilities of the platform targeted
C++ is good, and very powerful. And I have a million reasons not to use it unless absolutely necessary.
If you want to use it I'll give you 3 tips:
- Focus on STL and maybe Boost (use it sparringly and wisely! don't overdo it)
- Avoid inheritance hell
- Don't go crazy with Templates, in fact don't even use them (except for what's in STL already)
What's wrong with templates? This is the most powerful feature of C++ allowing for Generic programming, Polymorphism and metaprogramming. The latter is of course clunky considering C++ syntax, but overall templates are great. And STL is the best thing that happened to the C-like family of the languages.
Because type 'fixing' (that is, knowing what you need) happens at compile type, for example, duck typing ("even with" dynamic_cast - yes, dynamic_cast works at run-time, but you're limited in what kind of objects - by your inheritance hierarchy - can be present at the time you're doing the dynamic_cast)
You end up having to specify the type, you don't have a 'Generic' type. And you may have to deal with dynamic_cast
And read again, I'm not against STL, they 'get' templates.
Edit: confusing explanation
Do you really need one? Because then you really are dealing with run time polymorphism, whereas templates are all about compile time.
I recommend checking D programming language out. It has very powerful templates with a nicer syntax than C++ and a lot of other things aiding metaprogramming. Moreover with Ranges you get an implementation of ideas laid out in STL but with a better syntax and matching the power of what is in proper functional languages.
struct data {
void *data;
size_t length;
};
union value {
char *zstr;
int intgr;
float flt;
struct data *data;
};
enum type {
STRING,
INTEGER,
FLOATING,
DATA,
};What are your reasons for recommending said language over C++?
Firefox/Chrome: C++ looks like a good choice, still, there's a lot of JS behind them as well if I'm not mistaken. Now, Go may be a good choice
LLVM has interesting requirements, it needs to be both fast and needs a lot of 'flexibility'.
I would probably try making the next LLVM version in PyPy (which uses LLVM itself), so it maybe bootstrap itself using CPython first, hence bringing us one step closer to Skynet.
But in general Go/C#/PyPy may be steps in the right direction (Java is too afraid of new things being added to C# like anonymous functions, so it's behind)
The facts:
C# was created in 2000. After 12 years Microsoft still does not sell a single app written in C#. Not one.
C# is used for PowerShell (free) and MSN (free, the backend is mixed C# and Java).
This is not likely to change anytime soon: pretty much all Microsoft job openings require C++. Also for new projects MS recommends JavaScript or C++.
Python is not better off either: Google does not allow Python code in anything that can be seen by end user. (Youtube is Python, but it was bought, not built.)
I'm not saying C++ is perfect, just that for some use cases it is pretty good. For some other use cases obviously it is not the best choice.
Peter Norvig: "I think that language choice is not as important as all the other choices" http://news.ycombinator.com/item?id=1803815
Also for new projects MS recommends JavaScript or C++. This was one of the clashes between Microsoft divisions, the division between the new Metro (JS) and the rest, can't remember which side Sinofsky was on this.
Of course, to work at MS you have to know C++
" Google does not allow Python code in anything that can be seen by end user" really?! Didn't know that, maybe it has to do with their infrastructure and the way it scales. Can't say I blame them (still, GAE runs python)
A discussion from 2009: http://news.ycombinator.com/item?id=933493
2011: "Languages like Python are shunned upon because they're too slow for web frontends" http://slacy.com/blog/2011/03/what-larry-page-really-needs-t...
It is used for internal tool scripting like build, testing:
http://www.quora.com/Google-Chrome-for-iOS/Is-Chrome-for-iOS...
http://www.quora.com/What-kind-of-projects-at-Google-use-Pyt...
Python being 'too slow' makes sense, but at the same time it doesn't. For example, it has much more behaved GC (and reference counters)
I guess if Google wanted to make it 'super fast' it could. Or use PyPy. Or Jython
Notice that some of those URLs contain:
- http://support.google.com/adwords/bin/answer.py
- http://support.google.com/adwords/bin/static.py
- http://support.google.com/adwords/bin/topic.py
Do you know if those are actually written in Python, or are those implemented using some other language?
I once wrote a large part of a CSS+HTML renderer in OCaml (think: the very core of something like Firefox), and the ability to match over data structures and use trees naturally was a huge advantage.
ML was devised as a language to write compilers in, so LLVM is covered.
For an operating system you really want a lot of different languages because it's a huge undertaking that covers many domains. MirageOS is an OS written in OCaml, so that's a proof that it's possible at least.
I could only hope Rust is (still) just a codename.....
Q: What will Mozilla use Rust for?
A: Mozilla intends to use Rust as a platform for prototyping experimental browser architectures. Specifically, the hope is to develop a browser that is more amenable to parallelization than existing ones, while also being less prone to common C++ coding errors. The name of that project is Servo.
Q: Are you going to use this to suddenly rewrite the browser and change everything? Is the Mozilla Corporation trying to force the community to use a new language?
A: No. This is a research project. The point is to explore ideas. There is no plan to incorporate any Rust-based technology into Firefox.
Why this over C++? Well, first of all, basically anything is better is C++ at this point, but as for why Lisp in particular, there are a few reasons. First, I won't deny my own biases -- I know Lisp, I use it in my work, and I know that the tools to do the things I mentioned above already exist (perhaps an ML fan can answer whether or not such things are available in SML or OCaml). Second, Lisp is never really "out of date," in the sense that you do not need to rewrite your compiler to introduce a new language feature (consider what was required to add lexical closures to C++, and compare to something like CLOS, which can be implemented in macros for Lisps that do not have object oriented constructs). Finally, there is the expressive power of Lisp; an experienced Lisp programmer will run laps around an experienced C++ programmer, simply because it is easier to describe a complicated program in Lisp than in C++ (this argument also applies to ML, Haskell, Python, and dozens of other languages; again, I will not deny a personal bias towards Lisp).
There is the saying that any sufficiently large program contains a buggy and ill-specified version of Common Lisp... I would rephrase that as any sufficiently large program needing to contain its own extension language and programming language. JavaScript is filling that role for the browser, and I expect there to be a language in the future that does it better.
There won't be anything that replaces C (or C++). Go can't do it. But there will be something that works better with C and C++ for big performance-intensive applications. Lua is close. The reason I would prefer C is that C++ has a very hostile interface for another programming language to interface with.
I wish Python were there, but it's C API isn't really up to the task, especially with regard to concurrency (which e.g. Firefox and Chrome have a lot of!).
Then again most OOP languages get abused pretty badly.
At this point, C++ should be placed in the same category as COBOL: it is a language you learn because you need to maintain some old code that nobody has time to rewrite or replace.
No, it is not purely for compiler writers, but compiler writers and library implementors are a powerful group on the standards committee.
There was a time when Amazon was mostly C++, but it wasn't very recent.
I worked in Supply Chain specifically on the FC side of software (OK...specifically on COFS for those of you who remember) from 2004 till 2007 before moving over to retail. And I can say that all FC software was C and C++. There were small pockets of Java when I left, but I'd be really surprised if ALL of FC software has been ported to Java in the last 4 years. You're talking about 10+ years of software. Software that controls hardware that works as is. Tons of "bugs" and "features" to port.
And I'd call the software that runs the warehouses a major system.
My team tried to replace a C++ daemon with a Java one and our favourite phrase became "Oh yeah. Forgot about that business rule".
Oh, and there's at least one critical service written in Erlang =D
Similarly Adobe's most recent product Lightroom was about 63% written in Lua [1] which they attribute to its rapid development.
What would be interesting is a table which shows what percentage of developers or projects predominantly develop in C++. I am guessing it would be a much smaller number.
I'm not saying there's a causal relationship. Still, it might be an avenue to investigate for me.
Wait until you try Aperture, performance-wise Lightroom is heaven. I moved to Lightroom for this very reason. Adobe also supports new Camera's RAW formats earlier than Apple.
I never really peeked into the application bundle of Lightroom, but at least some of the plugins that I used were written in Lua.
http://www.alejandrosegovia.net/2011/09/08/herb-sutters-why-...
I also find function templates very useful while prototyping: Rather than having to select concrete data types up front, I write a function "as if" I have objects that can perform the operations I need. Now I have a concrete set of requirements (the standards committee calls this a "concept") for my classes. And if I've done it right, whatever abstract idea I've expressed in the function template need never be expressed again.
With some practice, it's remarkable how much C++ allows you to remove redundancy and repetition from your code. All without paying much, if any, of an abstraction tax.
There was one fundamental decision made back in the day about the copy constructor, where it takes a const reference as its single argument, that removed logically the C pointer problem. It's still possible to reintroduce it, but it helped prove correctness. In other words you can't make something unless the compiler knows that it's made something. Using an address the compiler has to take your word for it. You can think more contractually, as in say Eiffel, where if there is garbage in its not the programmers doing by definition. At its best it cures some C gotchas. At its worst it can be contrived and misapplied.
But as I say, you can break it any which way.
http://harmful.cat-v.org/software/c++/ tells you everything.
BTW, at least for Windows 8 now Microsoft recommends you to start new projects in JavaScript or C++ (in this order).
That Microsoft would recommend JavaScript or C++ is unsurprising, considering how much business those languages have generated for them and how many programmers who support the Windows ecosystem are only comfortable in one of those two languages.
It has it's uses.
There is a certain monotheistic outlook by most developers, and I fear this list does nothing to help it. Everyone knows the merrits and use of C++, surely its not in doubt, but to suggest that its the only solution is frankly silly.
An example plucked from the list that intreged me is Sophis, the risk system. The reason is more and more of these systems are been made in Java or .Net, in fact Sophis itself is using more .Net internally with every new revision. The reason being that performance issues are normally far more related to the algo than the language, having a mixture of functional bits thrown in helps the dev make a leaner algo. Mixing such paradigyms is just easier in .Net than C++.