4 ms·
In practice, C++ is considerably smaller than the theoretical extent of the language. Every C++ code base I ever worked on restricted itself to a subset of the
by jandrewrogers 14y ago
In practice, C++ is considerably smaller than the theoretical extent of the language. Every C++ code base I ever worked on restricted itself to a subset of the possible feature space. With C++11, you can have a restricted subset of C++ that is actually pretty decent as a programming language and relatively easy to maintain.
With respect to bit-twiddling, the advantages of C/C++ are not intrinsic; many other languages have broken implementations for this purpose. For example, a glaring deficiency in Java is the lack of large unsigned integers which are useful for many types of algorithms. You can always implement these algorithms with signed integers but they may be much slower as a consequence.
For most people though, memory control and optimization is the primary reason to use C/C++. While I can see why it is difficult code for people uncomfortable with it, I think you overestimate the complexity for people that have done it for years. Like LISP, you have to become used to it. It is similar to the reason why, despite some arguments, there are many huge C/C++ code bases that rarely leak memory despite very active development. Proper idioms and use are a discipline like anything else.
C++ is never coming back for front-end applications. It is unnecessary and inefficient for that purpose. However, on the server side (where I do development), C/C++ is expanding very rapidly. Five years ago almost all of the server engines I worked on were written in Java. These days, all new development is in C++. The reasoning is pragmatic: C++ offers much better performance and latency characteristics for server engines, primarily due to its excellent memory behavior and efficiency. The latency and throughput differences are often integer factor relative to other languages for server workloads, so it is not a small difference and people are very sensitive to operational costs and footprint these days.
I pretty much hated C++ for years but with C++11 it is not great but it is adequate. Too much junk glued onto the language too many times. But until something remotely as capable becomes widely used, C++ will be with us for a long time, particularly as power efficiency becomes more important.
- oelewapperke 14y agoThere's also, when it comes to hirability, the other end of the equation. When you know Java, PHP or even Ruby and Python, you've got craploads of competition. There's loads and loads of acceptably capable programmers in those languages. I think the amount of good enough C/C++ programmers is relatively tiny. Certainly compared to the amount of code in these languages.
- millstone 14y agoI don't agree that C++ is not coming back for front-end applications. There's some currents against managed code (i.e. WinRT), but more importantly, it never left. I assume you are using IE, Firefox, or a WebKit browser to read this; that means you are using a majority-C++ front-end app right now! In web browsers, text editors, video editing, IDEs, games, etc, there's hardly anything that can compete with C-derivative languages. Exceptions do exist (Eclipse, Minecraft) but are universally slow.
- motti 14y agoNot to mention Qt
- pcwalton 14y agoAlternatives to C++ are not universally slow for browser engines. I have first-hand experience here :)
- politician 14y ago"IE, Firefox, or a WebKit" are shims which allow UIs written in high-level languages to run on a variety of hardware. Their existence and popularity is evidence that argues against your claim.
- millstone 14y agoA shim is a thin and small piece of wood used to fill in small gaps. They make a very poor analogy to web browsers, which are tremendously sophisticated user-facing apps in their own right, and that dwarf the high level "UIs" they support in complexity.
- politician 14y agoBoth Mozilla and Google consider their browsers to be shims for the underlying OS. Firefox OS and Chrome OS betray that assessment. Accordingly, IE has been historically crippled by Microsoft because they realize that browsers obsolete operating systems in many important ways for end-users. Consider that operating systems are tremendously sophisticated user-facing applications in their own right, and that dwarf the high level "web browsers" they support in complexity. ;)
- corysama 14y agoBoth mobile and server-side software are kind of a big deal at the moment --to understate drastically. And both can benefit greatly from C++ for the simple reason that computation (and especially memory traffic) requires power and power comes at a cost --either in the form of data center electricity bills or in the form of bigger, clunkier batteries in your device. "Servers are cheaper than engineers" is certainly true in small-to-mid-scale development. But, I expect Facebook is shifting from PHP->HipHop->C++ to save money. Meanwhile on mobile, you can't just tell the user to buy multiple phones. Your only alternative to more efficient software is to sit and wait for faster chips to start using less power. Unfortunately, it looks like there is a power-wall coming up there pretty soon... http://darksilicon.org/ http://darksilicon.org/