1. 21
  1.  

  2. 9

    Man, this old anti-C++ fake interview, yet again.

    YOU try to build a nice, modern language while keeping almost all of C as a subset.

    Yes, C++ is ugly, but if you want generics, namespacing, automatic memory management, safe pointers, support for OOP and FP, and a rich stdlib, how else could you possibly do it?

    The alternative that Java, Rust, and D take is to have a C interface (and a partial C++ interface for D), but that’s not the same thing, and they drop the biggest problem in C++: C.

    1. 3

      C is to C++ as lung is to lung cancer. :)

      I think that the alternative (taken by your other languages) of having some FFI or something to C and marshaling is more than sufficient–not because C is so great, but because it’s so limited.

      The problem with limited tools is that, while they can shine in a certain use case (say, bit twiddling and close-to-the-metal numerical work) they become absolute garbage once you start forcing them out of their sweet spot.

      C is strictly better assembly language, which codifies some best practices for that world. Viewed that way, adding on other types of goop (template metaprogramming, lambdas, OOP, streams, and so forth) tends to obscure what it’s good for and then also hobble new features because of backwards compatibility.

      The original sin of C++ is that it tries to do too much, and that in production we have no use for a language that at once both lets us access individual registers/twiddle bits and also run Conway’s Game of Life during the compilation phase.

      EDIT: Not trolling, honest. Even in C we will sometimes acknowledged raw assembly as being a better fit than C, and so link with .s files. I think that C++ is not as good at what it does as either high-level languages (Haskell, OCaml, Java, Ruby) or low-level languages (C, Forth, assembler), and suffers immensely in complexity because it tries to bridge the gap.

      1. 4

        Saying C++ attempts to be high-level like Haskell or Java as a high-level language is not a fair comparison to what C++ aims to be. C++ is a systems language that aims to be a better C. There are some things in C that are indubitably better with at least a little C++. RAII is better than manual malloc and free. Some very limited C++ templates are better than CPP templates (the most basic usage, just a single type parameter). There is good reason why systems things such as clang and gcc are written in C++ and not in C (and not in Java, Haskell or Ruby).

        Again, I know C++ is ugly. But it really does solve at least some of the problems with C. If you want to solve all of them, you have to go with Rust or D, maybe Golang.

      2. 1

        Keeping most of C as a subset is not a worthwhile goal.

        Adding features on top of each other without considering how they interact is not a worthwhile design strategy.

      3. 3

        References were a great idea. :/