4 ms·
Yawn. C++ is terrible in myriad ways, it’s widely acknowledged; we’re just stuck with it for a little while longer until its replacements mature a bit. Besides,
by evincarofautumn 13y ago
Yawn. C++ is terrible in myriad ways, it’s widely acknowledged; we’re just stuck with it for a little while longer until its replacements mature a bit. Besides, “static” is worse.
Edit: I didn’t mean to dismiss the article; I meant to dismiss C++. It’s unsurprising to C++ users that the language is complex; we should choose our battles carefully. Why complain about “class”, which is a relatively innocuous design bug, when other issues are so much more pressing? How do we balance immutable objects against move semantics? How do we relax constraints in the standard library for improved performance, while also enforcing constraints for correctness and safety? How do we migrate away from C++ when there are no viable alternatives?
- p1esk 13y agoIs it better than C?
- eropple 13y agoThe reduction of issues from scope-based destruction--and the simpler-to-reason-about resource lifetimes that come with that--and the ease of writing more indicative code via polymorphism without the mess that is something like GObject make me say yes, and quite strongly. Even setting aside everything else, that's enough for me to use C++ for any project where I have a heap (which is all my projects).
- xerophtye 13y agoNope. C rocks. C is way way more powerful. Yes, they don't really teach the power of C in Programming 101, but take High Performance Computing. That's all C
- eropple 13y agoHPC is not "all C"; there are very, very large Java and C++ presences in both the academic and financial HPC spaces.
- ygra 13y agoAnd Fortran.
- p1esk 13y agoI'm planning to run simulations on GPUs using CUDA. What are pro/cons of going with C vs C++?
- 10098 13y agoDefine "powerful". Do you mean expressive power? If yes, I'm calling bullshit because C++ has all of the following (off the top of my head, and I won't even mention any OOP-y features): 1. Templates 2. Template-based standard library 3. Lambda expressions 4. std::bind all of which make C++ much more expressive than C. In terms of performance "power", there's almost no difference. Sure, calling a virtual method is slower than calling a function in C, but you don't have to "pay" for it with performance if you don't use it. EDIT: god-dang formatting
- evincarofautumn 13y agoIn certain ways, C++ is better than C. It has desirable features that C lacks. However, in certain ways C++ is worse than C, because the interplay of its many features creates much incidental complexity. For example, it was not feasible to write exception-safe code before smart pointers became ubiquitous. In addition, almost all the safety features of C++ are opt-in, when they ought to be opt-out. I want a language like C, one that interfaces well with C, but with memory safety, static polymorphism, real vector types (to avoid the aliasing problem), and real higher-order functions, all with minimal runtime overhead. So I’m building one (Kitten). Mozilla (Rust) and several others (Nimrod) have similar ideas.