I've found that whenever someone argues "X is best", they've only worked in projects where "X" makes sense for them. At a start up a couple of years ago, we had an intern that was all hot and bothered over C++ and boost. After he expanded is horizons to web development and investigating scripting languages, he really enjoyed Ruby. It depends on what you are working on, the libraries and tools available, and your comf…
Why C++ is vastly superior to C
91–100 of 123 posts
Re: Why C++ is vastly superior to C
#92Novice question: Why is C++ used for the vast majority of video games today? Why is it used for most commercial CFD codes? (A lot of codes in academia still use tons of legacy fortran though.)
Re: Why C++ is vastly superior to C
#93Earlier quoted context omitted.
I know Java is practical within certain contexts and for certain class of people, but our judgement of what's good or bad in general shouldn't really be a matter of taste and preference. Are we an engineering discipline or what? What we call a matter of preference is actually things that go beyond engineering. We may have emotional ties to programming languages ("I love Java", "I hate C++") because of job security, b…
"our judgement of what's good or bad in general shouldn't really be a matter of taste and preference. Are we an engineering discipline or what?" You know what. It's a funny thing, but as I was typing my response to your original post, I actually said this exact same thing to myself, and I started to think. It would be incredible if there was some non-emotional, non-touchy-feely way to get at the value of one language…
From this point of view, languages that are neither complex nor allow for complexity can be called "simplistic". They are easy to learn, easy to write code in, and as easy to grow to unmaintainable sizes because of their verbosity. Since we have very few readers here at the bottom of the thread, I will admit that every time I see all kinds of dancing around class instantiation, endless method calls etc in Java, where in some other language it would take a single function call, it reminds me of how kids count the steps out loud when they go up or down the stairs. When you grow older, you don't count any more, it's kind of implied :)
And I haven't found a better measure of quality of programming languages than that proposed by Paul Graham here: http://www.paulgraham.com/power.html
Edit: just noticed downvotes for my previous comment, so no, we are not alone :)
Re: Why C++ is vastly superior to C
#94Earlier quoted context omitted.
http://yosefk.com/c++fqa/defective.html isn't strictly limited to answering that question, but it touches on it a lot. I know I'm flinging links around a lot here, but, well, this is all well-covered ground.
Most of the points mentioned in that particular link pertains why both C and C++ are inferior to languages like LISP and Python which have garbage collectors, weak type system and the like. The bitching about bad compile time errors has been mostly fixed in clang. Then only _inconsistency_ (in the correct sense of the term) in C++ I am aware of is the unordered initialization of static objects. So if you have "class…
Yes, IOW, it is a compiler problem, not a language problem. Because one particular compiler is horrible on error presentation doesn't mean that the language is bad.
> declared somewhere with static linkage, it can be hard to pin down exactly _when_ that constructor will be called.
The language doesn't define it on purpose. The language leaves it to be defined by the implementation because it goes a little beyond the purpose of the compiler. The compiler transforms C++ source into object code. You can have multiple objects linked together into a single binary, and this linkage is very platform and operating-system dependent. C++ is already horribly difficult to implement correctly; if the language were to define an order for static initialization, it would be stepping on the operating system domain, and make it even more difficult to implement on some systems.
Re: Why C++ is vastly superior to C
#95This post boils down to "Take C, add support for OO, a crapload of new syntax, standard library that 10x as large and ta-da! you can find problems which have simpler solutions than in C." There's a great post by Linus Torvalds about C vs. C++ in the kernel. Some excerpts: "My point being, that C++ adds absolutely nothing interesting." "C++ is a mess. There's no design. It's just "add crud on top of C". And the crud i…
That said, when I'm working at the application level, C++ is better at a lot of things.
Finally, my cow-orkers and I have an agreement that if any of us start doing template metaprogramming, that that person will be shot.
Re: Why C++ is vastly superior to C
#96Earlier quoted context omitted.
I know Java is practical within certain contexts and for certain class of people, but our judgement of what's good or bad in general shouldn't really be a matter of taste and preference. Are we an engineering discipline or what? What we call a matter of preference is actually things that go beyond engineering. We may have emotional ties to programming languages ("I love Java", "I hate C++") because of job security, b…
"C is simplistic and can be considered dead the day C++ compilers catch up with speed and memory allocation" Those really are not the problems that are most pressing with C++ in the embedded field. Comparable speed is rarely noticeably different provided you avoid certain key things, and you can always just swap in a new allocator if you want.
I once switched from C++ to C because g++ just couldn't handle the module even having all optimizations turned off. That was a huge automatically generated C module with thousands of functions. A rather rare situation but showed very clearly that C++ is not almighty.
Re: Why C++ is vastly superior to C
#97Re: Why C++ is vastly superior to C
#98Earlier quoted context omitted.
"C is simplistic and can be considered dead the day C++ compilers catch up with speed and memory allocation" Those really are not the problems that are most pressing with C++ in the embedded field. Comparable speed is rarely noticeably different provided you avoid certain key things, and you can always just swap in a new allocator if you want.
By memory allocation I meant memory usage by the compiler itself. Plus libstdc++ which is not easy to get rid of, and if you do dump it, you at least cut off C++ exceptions. I once switched from C++ to C because g++ just couldn't handle the module even having all optimizations turned off. That was a huge automatically generated C module with thousands of functions. A rather rare situation but showed very clearly that…
No, for the very real issues with C++ in small installations, you will have to look at the language itself.
Re: Why C++ is vastly superior to C
#99For some things, C++ is better than C. For some things Lisp is better than either, and for yet other things, Python is better than them all. Why are people so insistent on declaring their view is absolutely right, with no arguments, everyone else is wrong, and that one language will rule them all? Trust me. For some things I do, C is vastly superior to C++, but I'm not going to try to convince everyone that C is bett…
I think much language criticism miss the non-technical context which influences which language is the best tool for the job. We are good at providing technical arguments (Erlang is fun if you need concurrency, C is cool if you need to get close to the metal), but there are important non-technical issues. Things like: How many people is on the team who have to work on the code? How big is the turnover among the develo…
Re: Why C++ is vastly superior to C
#100The problem with C++ is that the language is too damn big. This results in most programmers only learning really well a subset of the language. Unfortunately, different programmers end up with different subsets. I'd like to see some de facto standardization on subsets. For instance, there could be Basic C++. When programming Basic C++ you use it like C with the following C++ features added: constructors, destructors,…
Most projects have a set of coding guidelines. I don't see why it cannot specify things like: "Don't use operator overloading!". Google does, for one thing. Without discipline both C and C++ will blow you up completely. With some discipline both the languages are manageable, and C++ more so; which is what the OP points out.
coding guidelines are also to include programming idioms, primitives, to use and build the solution around it.
for c++, c and others i wrote many of guidelines, and seeing the benefit later i can say the above.