1. 12
  1.  

  2. 14

    When I was learning C++, it felt to me like very little of that knowledge was transferable. I wasn’t learning concepts or techniques that I could apply elsewhere, just the idiosyncrasies of C++. I guess that depends on what experience you bring into it; I picked it up relatively late in my computer life. It’s come in handy at some jobs, though; there’s always that legacy system that no-one really wants to touch, and I get to feel like a badass for volunteering. So for me, the value of learning C++ is simply that I can work on existing code, as well as read/learn from cool projects that happen to be written in it. I don’t think it’s rewarding in itself, but I agree on your point about confidence.

    1. 6

      it felt to me like very little of that knowledge was transferable. I wasn’t learning concepts or techniques that I could apply elsewhere, just the idiosyncrasies of C++.

      That’s a good way to phrase it, I thought that as well, but failed to articulate it. Also, c++ is the ultimate technical interview “stump the chump” quizz show language. I was once on a java interview, and I have c++ on my resume because I used to use it a lot. The interviewer started in on some c++ questions. I said ‘woah, is this a c++ position here?” No, it’s java was the reply. “Let’s stick to java shall we?” I did not get an offer, wouldn’t have accepted anyway.

      1. 4

        it felt to me like very little of that knowledge was transferable. I wasn’t learning concepts or techniques that I could apply elsewhere, just the idiosyncrasies of C++

        Same here. Later, I learned it was features of wildly-different languages merged together in a C-compatible way. Then, they kept extending it. The result is a mess of a language. PreScheme and Modula-3 had cleaner, consistent designs with plenty of features. With good design, they also compile really fast. Slow compiles were a major factor in keeping me away from C++. For modern stuff, D’s design eliminated that with many benefits. Rust was slow to compile last I looked but brought major benefits to justify it. Nim has nice syntax, macros, and C compatibility. Idk about compile times.

        So, looking at competition, I find C++ to just be unnecessarily hard to learn and use due to its design choices. Different design choices could’ve improved syntax, safety, compile time, or even more runtime efficiency. The good news is there’s alternatives now with decent ecosystems, one a great ecosystem. Unless doing legacy code, I’d say invest effort into one or more of those instead. Further, remember that ports of legacy components don’t necessarily require knowing the language: one might team up with a person that knows that language for them to translate the code for you into pseudocode or something.

        1. 5

          Yeah, Rust is my weapon of choice for new projects. Compile times are pretty bad on my old T420, but is slowly improving. I am eagerly looking forward to possible alternative backends for debug builds.

          1. 2

            I keep using C++ for two reasons. One, Bjarne is the greatest language designer because he never gave up and created a language that is only becoming more relevant over time. Other designers give up and end up making new languages, one after another. Two, it turns out the world is a messy place and C++ has lots of symmetry breaking features. “Clean elegant” languages fail to make programming for humans as easy.

            1. 4

              What is the value in a symmetry breaking feature?

              1. 2

                I think one is addressed mostly by the economic and social side of it like with C/UNIX’s spread. It can be an advantage but allows for designing better languages that similarly use ecosystem power. Even lots of C++ compatibility without as many disadvantages. ZL was an attempt that gets no attention. On your second point, C++ seems to have unnecessary complexity and performance impact vs its competitors which mean it’s unclean or inelegant for unjustified reasons. A better C++ could be created that reduced the difficulties or gave even more benefits justifying dealing with the language complexity. I already named some doing that.

                There’s definitely a lot of critical apps written in C++, though. Very unfortunate, too, since I wanted to apply strong assurance technology to some of them. There was hardly anything to use compared to C. The learning curve was also huge compared to some others. Had to back off on that but still thinking conceptually about translaters, including like ZL.

          2. 6

            Learning modern c++ with move only semantics and rvalue references and so on let me understand the problem Rust is trying to solve.

            1. 6

              All these points mentioned in the post are also applied to C except latest language standard revision. Also, C have C11.

              Why I am pointing out C? Because I am still not fan of C++ syntax.

              1. 5

                I think it is a stretch to say C is in active development. It is at best in maintenance mode.

                C++ is in active development.

                1. 11

                  It looks like C is on track to possibly get a new published standard around 2021/2022. It also seems to me that C has always been a significantly simpler language than C++. Where C++ is getting everything and the kitchen sink, making an already complex language even more complex, C has less to change and therefore changes less frequently.

                  1. 9

                    One barrier here is that Microsoft has seemingly decided to stop working on C compatibility with MSVC; it doesn’t even fully support C99 yet, let alone C11. A new standard doesn’t matter much if one of the largest platforms in the world won’t support it.

                    1. 2

                      A new standard doesn’t matter much if one of the largest platforms in the world won’t support it.

                      These days I would not be much surprised if Microsoft would replace MSVC with clang or even GCC.

                      1. 4

                        Why? My impression is that the MSVC compiler is quite good. I only use the linker daily, not the compiler itself, but especially recently, I’ve only heard good things. Very different than ten or even five years ago.

                        1. 2

                          Why?

                          A project manager making their numbers look better on the compiler side by using less programmers and moving at higher velocity. The reason: clang or GCC are doing most of that work now with MSVC a front end for them.

                          1. 1

                            I’m sorry, I’m finding this reply really hard to parse.

                            Are you saying, people will move compilers because they want to use the new standard, which brings benefits?

                            And what’s this about MSVC being a front-end for Clang?

                            1. 3

                              You asked why Microsoft would ditch their proprietary compiler that they pay to maintain in favor of a possibly-better one others maintain and improve. I offered cost cutting or possibly-better aspects as reasons that a Microsoft manager might cite for a move. Business reasons for doing something should always be considered if wondering what business people might do.

                              Far as front end part, that was just speculation about how they might keep some MSVC properties if they swapped it out for a different compiler. I’ve been off MSVC for a long time but I’d imagine there’s features in there their code might rely on which GCC or Clang might not have. If so, they can front end that stuff into whatever other compiler can handle. If not and purely portable code, then they don’t need a front end at all.

                              1. 3

                                Ah, ah, yes. Sorry. Makes perfect sense now.

              2. 6

                I find that the combination of points 2 (evolving) & 3 (old enough to have established body of literature) is actually rather a bad thing, as there is an enormous amount of outdated literature. Some of it will teach you to write old-school code that will not be welcome in a modern C++ codebase. The rest of it will devote 80% to writing elaborate constructs to implement features which are now part of the language.

                1. 3

                  I found that, too. It was especially jarring since part of point 2 is that different C++ versions can behave differently with the same code – even if that situation is rare, that knowledge makes any legacy documentation suspect.

                2. 5

                  Since the article mentions modern C++, can someone with some more practical experience weigh in on how relevant cat-v.org’s collected criticisms still are? I know the page hasn’t been maintained too much, so maybe things have improved?

                  1. 5

                    I’m curious what book people would recommend for someone to pickup C++. I already can program, but I’ve avoided C++ because of the reputation and also the syntax, but its something I’d really like to get at least comfortable in.

                    1. 5

                      A Tour of C++ isn’t bad, particularly if you’re already familiar with C. After that it’s mostly practice – write a ray-tracer or some such.

                      The second edition comes out in a month.

                      1. 4

                        I think it’s more than practice. There’s no way I was going to learn all the wrinkles in C++ without reading Scott Meyers’ Effective C++ series.

                        1. 3

                          Sure, something like Effective Modern C++ is a fine choice after becoming competent at C++. That’s advanced material though, more for the kind of people who set coding guidelines for teams.

                          1. 3

                            IME, without a detailed understanding of C++ ownership semantics you are going to hit some utterly impenetrable bugs pretty quickly.

                        2. 1

                          thanks for posting this, I’ll definitely check out the book, especially if a new edition is right around the corner.

                        3. 3

                          I like C++ Primer. It’s a whole lotta book, but it’s a whole lotta language and the book does an excellent job running you through a relatively recent version of the language. I’m currently working through Introduction to Design Patterns in C++ with QT. It’s a little dated but I’ve heard good things. Accelerated C++ is another I’ve picked up recently that seems to be well regarded. I’ve worked a bit with older C++98 style code in the past, but things have changed a bit with the advent of C++11 and especially later…

                          1. 1

                            thanks for taking the time to reply. One of the reasons I’ve avoided the language so far is just the massive size of it in comparison to my other languages.

                        4. 4

                          TLDR: C++ is a system programming language that is established and in active development.

                          1. 7

                            And super-complicated. So, you can take pride in learning a specific, super-complicated thing. I’d advise that effort instead go into learning a codebase of critical app to improve it.

                            1. 3

                              Turns out a lot of critical apps are written in C++ ….

                          2. 1

                            Learn C, well, then very well, then learn what OOP is (theoretically), try to implement a OOP Lang yourself (the easiest way is to implement a superset of C) and then learn C++.

                            When people learn C++ straights away they usually (there are exception obviously) very bad developers.

                            1. 1

                              I think the arguments in this article would apply better to C, and I agree that everyone should tinker with C a bit to gain some historical grounding.

                              I would dis-recommend C++ precisely because it changes every few years, creating a moving target, but never deprecating or removing the failed experiments of older versions. It’s ended up having too many (often conflicting) features to allow depth of understanding. Modern concepts are “nailed on” but not integrated well, muddying the waters for beginners.

                              To learn modern concepts, you should play with a modern language. To learn the foundations, C has a much smaller syntax and set of concepts to deal with.