3 ms·
> There's really very little reason to ever use C over C++ with modern toolchains. - most C code compiles magnitudes faster than most C++ code (unless you don'
by flohofwoe 9y ago
> There's really very little reason to ever use C over C++ with modern toolchains.
- most C code compiles magnitudes faster than most C++ code (unless you don't use templates or the C++ stdlib)
- you need C headers anyway for the public API, because the C++ ABI is not standardized (and a mess), trying to do shared libraries with C++ would result in such abominations like COM
- about half of features that C++ adds on top of C only make sense if you do OOP and encourage bad practices
- C is a much simpler and "complete" language, there's less room for debating about coding style, what C++ subset to use etc... (that's one thing that Go got right).
Also, Eric S.Raymond's "informed rant" on C++ is relevant: http://esr.ibiblio.org/?p=7724 http://esr.ibiblio.org/?p=7724
I'd really like to see a simple language which fixes C's (very few) flaws succeed, but C++ ain't that.
- jensa1948 9y agoEric S. Raymond's article is indeed interesting, but it doesn't contain a lot of real arguments. I find most of them to be anecdotes and they are not very convincing. The most convincing one is that people who are not proficient in C++ write code with horrible errors, and that is because the language contains so many subtle (and obvious) ways to shoot yourself in the head. Most of the problems C++ has are coming from being backward-compatible with outdated language features, explicitly the C-subset. Even the problems with the toolchain are more less inherited from the C compile-link model and its use of the preprocessor as a "module" system. If you use the language as intended, e.g. in the C++ core guidelines, you will se very nice language emerging which enables to write very efficient and elegant code, sometimes doing things that C cannot do, such as expression templates.
- sjellis 9y ago"If you use the language as intended, e.g. in the C++ core guidelines, you will se very nice language emerging which enables to write very efficient and elegant code, sometimes doing things that C cannot do, such as expression templates." JavaScript is also an ongoing effort to extract and evolve a good working language out of a mass of features. It's obviously doable, but not easy, and there are a lot of problems in practice.