6 ms·
C++ - The Forgotten Trojan Horse
- noss 17y agoLook at all that comment spam. How lovely.
- aurora72 17y agoIt's been a long time since the last time I saw spam in a blog. Totally embarrasing.
- InkweaverReview 17y agoYeah. Great post, but the comment spam shows that this site isn't very well maintained. Clearly the author hasn't spent much time on it in a long time. Too bad.
- francoisdevlin 17y agoThis should be required reading for anyone trying to push a new language in a Java/C# shop. Don't fight the platform, instead, leverage it to your advantage.
- kqr2 17y agoLinus Torvalds thoughts on C++: http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918 http://thread.gmane.org/gmane.comp.version-control.git/57643...
- kingkongrevenge 17y agoI couldn't find any useful information in that thread. A couple C aficionados basically scream they don't like C++ and baselessly claim it has performance and portability problems.
- dkarl 17y agoThose aren't his thoughts. Those are his thoughts morphed into a flame meant to stop people from bugging him about a particular decision he made that he believed was correct and didn't want to revisit ad nauseam.
- kqr2 17y agoCan someone post a link to his actual thoughts on C++?
- dkarl 17y agoNever seen it happen :-) I'm sure if he shared his actual thoughts, it would bring him some serious hassle, what with people wanting to debate with him. Much easier just to make it clear he isn't willing to be reasonable on the topic.
- siim 17y agohttp://kerneltrap.org/node/2067 http://kerneltrap.org/node/2067
- huhtenberg 17y ago> the whole C++ exception handling thing is fundamentally broken While I completely agree that using C++ in the kernel is not the brightest idea, I am curious what's so fundamentally broken about C++ exception handling. It certainly comes with performance penalties, sometimes considerable (especially on the fast paths), but why is it flawed fundamentally ?
- mojuba 17y agoThere is some explanation here: http://yosefk.com/c++fqa/defective.html#defect-10 http://yosefk.com/c++fqa/defective.html#defect-10 Almost makes sense to me, except any feature in C and C++ can be criticized this way. In the C/C++ land you have access to hardware, plus almost every resource (except maybe function stack frames) is allocated and deallocated manually. In C/C++ you can make a mistake with virtually any operation that involves pointers, buffer overruns being perhaps the most popular one. So? Dump pointers altogether? Or take "return" - basically same problem as with "throw" (although only within one function) - it can bypass some resource deallocations. C/C++ is like a scalpel, it requires professionalism and great, great care and you can do wonderful, magical things with it.
- 17y ago
- sutro 17y agoThis is the same strategy that Clojure is now using, which is why it's the only LISP that has any chance of going mainstream.
- kqr2 17y agoI don't think Clojure uses the same "trojan horse" strategy, i.e. it isn't a superset of the Java language with Lisp extensions. It does use the Java virtual machine, however, which allows it to use existing java libraries.
- dkarl 17y agoImplementing Java interfaces and subclassing Java classes does allow Clojure programmers to introduce Clojure into a Java organization without forcing the Java programmers to accommodate them in any special way. (That is, as long as Clojure code can be deployed easily as jars, and as long as Clojure doesn't create any special classloader problems because of its runtime system. Those are problems that bit me hard when I used Jython code in the Eclipse plugin framework, and I imagine any dynamic language might accidentally create classloader problems unless it was specifically designed to avoid them.)
- ajross 17y agoAlways useful reading for anyone who thinks C++ is great and can't understand all the curmudgeons who think otherwise: http://yosefk.com/c++fqa/defective.html http://yosefk.com/c++fqa/defective.html The rest of the FQA site is good too, but the summary is the best enumeration of all the brain damage.
- siim 17y agoOK, picked one random whine: "When an invalid program finally crashes (or enters an infinite loop, or goes to sleep forever), what you're left with is basically the binary snapshot of its state (a common name for it is a "core dump"). You have to make sense of it in order to find the bug." If you write an invalid program... Then you are doing it completely wrong! (http://lemonodor.com/archives/2007/10/youre_doing_it_wrong.html http://lemonodor.com/archives/2007/10/youre_doing_it_wrong.h...) There are two types of peope: those who belive what they read and those who want to try out their own and then read and after that whine or ... :)
- huhtenberg 17y ago> OK, picked one random whine: The whole list is a one big whine that in parts is staggeringly clueless. It reads like its author has challenged himself to come up with as many "Defective" or "Very complicated" items as he could just for the sake of making the list looooong.
- dave_au 17y agoSome of them are just wrong, and a few of the wrong ones seem to be intentionally wrong. C++ has quite a few flaws, but I've always considered the FQA to be a troll.
- old-gregg 17y agoBelieve me, those who truly believe that C++ is great, consider some of those deficiencies to be advantages. It helps to remember, that C and C++ don't exist on an "VM island", i.e. as an isolated process, like all high-level programming languages do. They are effectively extensions of UNIX-derived operating systems, i.e. they run under "UNIX VM". They even have a garbage collection of sorts: when you exit the program, the memory gets freed. And, according to Linux philosophy, launching processes or forking/dying should be quick, efficient and, in fact, desirable. Also, having many independent binary modules is the norm, so here is your runtime encapsulation. But C family is still the only tool out there that allows you to extend an OS, i.e. for instance to build a piece of code, a single instance of which will be serving all other simultaneously running processes. This explains why Apache eats so little RAM. None of VM-based languages can do that. It's called systems programming. Building a web-based CRM in C++ is stupid. Building a filesystem in Python is impossible.
- thras 17y agoThis article is silly. The real reason for the rise of C++ is that "C with Objects" fit the metaphors that GUI libraries need a lot better than C. And in the end...it's not such a bad language. In the real world, you only use a small part of it on any one project. In the real world, your framework or libraries matter more than the language anyway. And in the real world, performance always matters in the end.
- adamc 17y agoI don't agree on the last. In the "real world" that I am familiar with, performance is often irrelevant. Lots of programs get written that don't need to run fast or don't do enough work for performance to be an issue.
- thras 17y agoWell, if we're talking "programs" as opposed to administration glue scripts, I see very few fields where performance doesn't matter. It matters for online apps. It matters for GUI applications. It matters for games. It matters for scientific software. Operating systems. Embedded apps. I suppose there are some enterprise business niche software fields somewhere where it doesn't matter -- until someone decides to write some competing software and sell it, that is.
- gaius 17y agoNot least because better performance means less money spent on hardware, power, cooling, less space occupied in the datacentre, etc etc. Joe Hacker might not care about performance of his scripts on his VM he's got from a hosting provider, but you can bet they care a great deal about how many VMs they can fit on one physical host.
- adamc 17y agoWow, quite the load of BS ego there. The average page in the wide-wide world is seldom visited and its performance doesn't matter. There are any number of GUI programs I use that are just utilities whose performance matters very little. And, yes, there is plenty of business software that needs to do its job correctly but where the performance is unimportant, or nearly so. Kind of disappointed in HN for rating you up. Just goes to show...
- quizzical 17y agoThis article is equating anything that is feature rich and highly competent to being a Trojan Horse. If so, then bring on the horses!