6 ms·
This is like insisting on driving around in a horse-drawn buggy because a car can crash at higher speeds. At this point I just ignore anybody trashing C++ that
by cageface 14y ago
This is like insisting on driving around in a horse-drawn buggy because a car can crash at higher speeds. At this point I just ignore anybody trashing C++ that isn't offering any real alternatives. And no, C isn't an alternative for large scale app development.
- Nursie 14y agoIt's true, nobody ever wrote a large scale app in C. Ever.
- ttflee 14y agoIMHO, you missed the Linux kernel(, OK, it's kernel and does not count as an app).
- jlgreco 14y agoI suspect Nursie is being sarcastic.
- Nursie 14y agojlgreco is correct, that was deep and sincere sarcasm on my part. C is an extremely capable language and I personally have (technical, not people) managed millions of lines of it. I really don't understand the mentality that C is hard, that memory management is hard, that pthread-multithreading is hard and that complex systems in C are impossible, But then I've been coding in it professionally for about 12 years, so I guess I just grok it.
- cageface 14y agoI first started writing C code in about 1988. I still find it by far the hardest of the mainstream programming languages to avoid resource leaks, buffer overruns, and gratuitously verbose code.
- Nursie 14y agoPerhaps it is, I don't have a lot to compare it to other than higher level dynamic languages like python. Those I can forgive somehow, probably because I don't usually feel like I'm doing anything serious with them, In the mid level (C++, Java) I find not minutely managing every resource quite alien. I'm currently working in C++ with/for someone deeply in love with STL, boost, RAII and overly gratuitous typecasts and I'll admit I'm finding it a tough transition. I guess I'm deeply in love with the 'everything is just a patch of memory' paradigm I've become used to.
- rm445 14y agoHow did you miss the dripping sarcasm there?
- betterunix 14y agoWho gets to decide what qualifies as a "real alternative?" I have seen much larger applications written in Java than in C++; does that make Java a "real alternative?" C++ does not really have any technical advantages over "true" high-level languages (i.e. languages that don't force the programmer to deal with low-level details and whose support for low-level operations does not constrain high-level features), but it has plenty of disadvantages. Meanwhile, I cannot think of anything people do in C++ that I am unable to do in Lisp, although I can think of plenty of things people do in C++ that are unnecessary in Lisp and that only serve to make code more complex and more error-prone. So there, you have two "real alternatives:" Java and Lisp. I'll also throw in Scala (basically it's what Java should have been to begin with) and OCaml. So what are you doing in C++ that could not be done in any of these languages?
- cageface 14y agoNone of those languages give you the raw performance or low-level memory control of C++ and this is exactly why none of them are used to write things like Chrome, Firefox, Ableton Live, Photoshop, AutoCad, the JVM etc. If you can write your app in a higher level language than C++ then you'd be nuts to use it but there still isn't any real alternative for performance-critical native applications.
- betterunix 14y ago"None of those languages give you the raw performance or low-level memory control of C++" Really? That's funny, because entire OSes have been written in Lisp, and I am pretty sure that those systems needed low-level memory control. In fact, the Lisp compiler I use in my own work has support for low-level pointer operations and a form of inline assembly (which in the past was used to implement SSE intrinsics as an add-on library). I am not sure where people got this idea that all high-level languages were slow or robbed programmers of the ability to do low-level things. "why none of them are used to write things like Chrome, Firefox, Ableton Live, Photoshop, AutoCad, the JVM etc." I suspect that has more to do with the OSes that were targeted and the availability of C/C++ programmers who are familiar with programming for those OSes than with some hypothetical performance advantage of C or C++.
- haberman 14y agoFor the record I was not "trashing" C++, I like it more than most languages and write it every day. The code I work with is mostly at Google where we have a style guide that defines a pretty nice C++ subset: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml http://google-styleguide.googlecode.com/svn/trunk/cppguide.x... I was just saying that some of the complicated designs you can express in C++ are a bad idea.
- cageface 14y agoThanks for the clarification. And I completely agree that it's very easy to misuse C++. If I could find another language that let me do real-time DSP on consumer phones I'd switch in a heartbeat but for the things I care about it's still the only game in town. I think I just get tired of all the C++ bashing from people that either don't understand it or don't need it.
- SeanDav 14y agoThanks for the link to that C++ style guide