3 ms·
You've made some awesome points, and I don't disagree that C++ has gotten to the place where you're juggling a freaking lot of stuff around. In straight C you s
by DanielBMarkham 17y ago
You've made some awesome points, and I don't disagree that C++ has gotten to the place where you're juggling a freaking lot of stuff around. In straight C you start at point A and code until you reach point B. In C++ if you're not careful you create a map of the known world in Portuguese and then start defining what the word "is" means.
I think back on my C++ production code -- heavy-duty COM stuff, device drivers, embedded software -- and I'd still stick with C++. The trick is that I wouldn't pull in every feature from all over the place.
Modern languages -- especially those that have been around for a long time -- have a lot of cruft. Do you need templates on every project? Most likely not. Do you need the STL? Maybe bits of it but not all by any means. Do you need a freaking class graph with 50 nodes to start sorting integers? No, but bad programmers will make one.
One of the reasons I love C++ is that it makes you understand how to differentiate the bullshit from the solution. This is the flip-side of the exact point you made about having so many options. Got a problem with allocation? Roll an allocator. C++ is the nuclear bomb of power tools, and there are a million ways to cut your arm off.
But for small utilities where you don't touch the metal or interact with some larger, more complex system? C++ isn't the tool.
I completely agree that C++ has some really bad/ouch-don't-do-that things in there. I just think that overall the pluses outweigh the minuses for a certain small set of problems. (and coders)
- tptacek 17y agoYou see C++ as a nuclear weapon. I see it as that automatic hammer Homer Simpson made after he visited the Edison museum.
- DanielBMarkham 17y agoKeeping the topic to "should I learn C++" and "will there be a C++ in the future" Want to program the iPhone? Learn Objective-C, a bastardized C++ language Want to build some shit-hot hardware for NASA or the Defense Department? Pick up VxWorks and WindRiver -- and welcome to C++ Want to write your own O/S kernal? Hell if I'd do it in C. C++ gives me nice namespaces and modules and an easier way of organizing things. So yes, C++ is going to be around for a long, long time. And the concepts you learn in C++ -- assuming you can become a good C++ programmer -- are going to make you a much more proficient programmer in any of the "better" languages. But fair warning: if you dabble? Yes, you'll be Homer Simpson.
- tptacek 17y agoNo idea why you got downmodded --- perhaps for the crack about OS kernels, though. Every mainstream OS kernel is C.
- DanielBMarkham 17y agoBeats me. I didn't say the existing kernels were C++. I said if I wanted to write a new one it would be in C++. I certainly know the existing kernels are C++. Some of the kernel code for popular Operating Systems -- in production now -- goes back 30 or 40 years. If I'm not mistaken, the Windows kernel has evolved quite a bit to C++. Even the core C files are compiled using the C++ switches. Not sure, but not relevant to my point either. Hope this discussion helps the poster, which is the goal here. Like I said, you made some great points, and I agree with quite a bit of what you wrote. But understanding the exceptions and edge cases are important, even if the guy doesn't choose C++.
- jacquesm 17y agoThe reason why you probably would want to write your kernel in C over C++ is that C++ does more 'under the hood' and when you're writing an OS you want to have your code as transparent as it can possibly get. Any side effects that are not explicitly mentioned in the code will get you burned at some point.