Linus Torvalds Was (Sorta) Wrong About C++

With all the new (and new-ish) languages out there, you might wonder why it’s still worth learning C++, a language first invented in 1983. Wedged amidst lower-level languages such as C, C++ went through a spike in popularity in the mid-‘90s, when developers realized it was easily translatable to assembly language; but today’s higher-level languages abstract the processor even further away.

C++ has a lot in common with its parent, C; but C++ does a good bit more behind the scenes. Let’s talk about some of the anger towards C++ over that “behind the scenes” thing; you don’t have to look far to find someone who dislikes C++ specifically because of it.

Check out the latest C++ jobs.

Back in the early 1990s, I worked for a software company as a programmer. The company had recently moved from C to C++, and one of the senior developers was frustrated, complaining that calling member functions required a lookup table behind the scenes (he was referring to the virtual method table) rather than just a straight memory address; that really irked him because he felt it slowed the program down. (Even back then, the impact of the virtual method table was negligible in the applications we were building.)

But perhaps the most famous rant against C++ came from none other than Linus Torvalds. It features some choice bits:

C++ is a horrible language. It’s made more horrible by the fact that a lot of substandard programmers use it, to the point where it’s much much easier to generate total and utter crap with it. Quite frankly, even if the choice of C were to do *nothing* but keep the C++ programmers out, that in itself would be a huge reason to use C.

Torvalds had a problem with the library features of C++ such as STL and Boost, which he thinks are a.) unstable, and b.) inefficient, forcing developers to rewrite apps once they realize their code depends too much on the nice object models around it:

In other words, the only way to do good, efficient, and system-level and portable C++ ends up to limit yourself to all the things that are basically available in C. And limiting your project to C means that people don’t screw that up, and also means that you get a lot of programmers that do actually understand low-level issues and don’t screw things up with any idiotic “object model” crap.

Tell us how you really feel, Linus.

There are plenty of rebuttals to his attack, but I’ll just make two points. First, he obviously knows his stuff. Second, C does have its place… if you’re writing systems-level code that you want as tight and portable as possible. That latter concern aside, though, this is the 21st century: Why write dozens of lines of code when a single line of code (as with C++) will do it?

A multitude of companies believe the benefits of C++ outweigh the drawbacks; although higher-level languages such as Python and C# have really taken off, there are still lots of C++ jobs; it’s not going away anytime soon.

Supporters argue that C++ provides a fine mix of C’s low-level aspects (looking at the compiled assembly code, etc.) while providing higher-level attributes found in today’s modern languages. Early in its development, C++ featured a standard template library (STL) with template classes such as vectors and maps, which allows for a certain level of generic programming. The STL allowed programmers to focus on applications-level tasks without having to write their own linked lists and other data structures every time.

But such functionality must be used responsibly. I’ve witnessed a lot of “over-engineering” in my life, wherein people would write reusable classes with several layers of inheritance, even though the reusable class wasn’t actually used more than once; worse, that sort of behavior can result in massive libraries of classes nearly impossible to debug. But I would argue that’s the exception, not the norm; when done right, generic programming and other high-level aspects of C++ can provide enormous benefits.

Along Came C++11

Fifteen or so years ago, as languages such as JavaScript and Python became more popular, programmers began to embrace techniques and styles that, while not new, were easily available in those languages. Meanwhile, a group of C++ experts began putting together a library called Boost, which pushed the features of C++ to the limits, giving programmers access to the techniques commonly used in other, newer languages. Many of the creators of Boost were on the C++ Standards Committee, and some of the Boost features have found their way into the latest official incarnation of C++, called C++11.

Keeping with our theme here, C++11 does even more “behind the scenes” than its predecessors. But that’s not a bad thing, depending on how you use it; for example, C++11 now offers lambda functions as an official part of the language. Lambda functions in C++ have a strange-yet-expressive syntax that might take some getting used to, as you can see in this example (which barely scratches the surface of C++ lambdas):

auto myfunc = []() { cout << “Greetings from the lambda” << endl; };

This creates a function and stores it in a variable called myfunc. (The concept of storing a function in a variable is familiar to programmers in other languages such as JavaScript.) You can use lambda functions in places where you previously might have used function pointers. Yes, they do a lot behind the scenes, but they also hold great potential.

Systems-level programming probably still needs C, but for high-level applications, C++ is a great choice. And judging by the number of C++ jobs today, the language is not going away anytime soon. Now is still a great time to learn this older programming language; don’t let the famous naysayers and their profane soliloquies about inelegance dissuade you.

Upload Your ResumeEmployers want candidates like you. Upload your resume. Show them you’re awesome.

Image: Gajus/

81 Responses to “Linus Torvalds Was (Sorta) Wrong About C++”

    • Throw away all the videogames, OSs, and system critical software you have. Aircrafts, spacecrafts, to hell all of them. You don’t have an idea of what’s nowadays running on C++. And me neither.

      • Both PFF and TWINT are saying the truth, but the TWINT’s reply isn’t much related to the PFF answer.
        C/C++ is very old, and still carries “ancient” ways to program which DID have sense in the ’70-’80, but nowadays really sound literally absurd. I may cite “.h”, very few standards (compared to other languages), ease to fall in the anarchy!
        By the way, I believe there’ll be billions of lines of code everywhere. Once an application/library works, why should be rewritten in another language?
        The C/C++ problem is like pretending all the US using the metric system…

      • @TWINT, don’t forget the compilers and JIT’s, along with essentially every piece of mainstream application software in existence. Remember that Sun started trying to write what became Open Office and Libre Office in Java, but found that it was (1) not portable enough and (2) too slow. And it inflicts no JIT load-lag.

        AND, like C#, it lets you code transparently in C, the foundation (direct or indirect) of all later languages, whenever you need to.

        It sounds like @PFF failed an early/freshman C++ course and hasn’t grown out of it…
        PFF’s rant was pointer-less.

      • spacecrafts, in C++? C++ is an awful language for mission critical applications. Mission critical software is generally developed in Ada. C++ is a minefield of unexpected and compiler dependent behavior (e.g. copy operations may or may not happen depending on how the compiler feels like, and plenty of similar stuff). The fact that there’s a book specifically written about C++ gotchas tells you a lot about the language.

        C++ wants to provide blazing performance while allowing for advanced constructs, with the result that you _will_ mess it up.

        I am with Linus on this one.

    • Erik Alapää

      Torvalds is a sharp guy, but he is wrong about C++. It is not a perfect language, but I prefer to develop fast, object-oriented software using C++. C still uses void* everywhere, I mean, come on, it is 2015! And the Linux kernel basically reinvents the wheel when it comes to classes and inheritance. The iOS and Darwin kernels use C++ (IOKit).

      There are only 3 ways to write kernels: Assembler, C, or C++. And only one of those languages have classes, templates, and a good standard library (including STL). Write C if you like it, but stop peddling lies and ignorance about modern C++.

      • I think part of the problem is frankly, the syntax hasn’t aged well.

        For anything low level, use C
        For anything mid level, use C++
        For anything high level, use C#

        Right language for the right job.

    • That one line of code is EXACTLY the reason why those who want to become programmers look at C++ and conclude that learning Chinese would be easier. It seems like too much work to get your brain around constructs that bare your way with inscrutable syntax and unintuitive formatting.
      Let me OUT of here!!!

    • In APL every operator is either niladic, monadic or dyadic, operator precedence is always right-to-left and every data structure is an array. What could be simpler?

      In C++ there’s something called “operator overrides.”

      Like countless usenet .signatures said back in the day:

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

      • Operator overrides have their uses, but it’s up to the developer to use them sanely.

        That’s the point of C++: It will let you do pretty much anything you want. But its up to you to use that power in a responsible manner.

      • Are you even using functions and methods? After all, how can you be sure what .append() does? Or .data()? Or whatever function? Operators are usually more expressive, but they are exactly the same thing as functions. So ranting against operators is really ranting against using functions. Let’s write assembler everyone!

        If Bjarne decided to define ABI for C++ in its early days, I don’t think anyone would be even using C today.

  1. Narendra Modi

    I agree to some extent.Problem with C++ over other languages is learning curve is quite steep than other languages. This ‘killing time’ to learn really frustrate new developers who find #c,Java,Python useful. You can create some working app in less than a month in any of these languages.

  2. The fact that there are a lot of C++ jobs out there and that C++ is widely used, doesn’t invalidate Linus Torvald’s opinion (or rant) against C++. At some point in history the majority of people thought the Earth to be flat and the Sun to revolve around the Earth.

    I’m a C++ developer, and I’m using C++, STL & Boost extensively at work, and with it we face a lot of problems that usually are deemed “a necessary evil”: hard debugability, deep inheritances for non shared code, large (massive) compile times, you name it.

    On the other hand, I’m involved on other projects that use a C like subset of C++, and yes, we face other problems (who doesn’t?), but compile times are down to seconds, code is straightforward and easy to debug, and programming is fun again! 😀

    Why a subset of C++ and not C? We basically use C, but a few features of C++ are nice to have: function overloading, no need to typedef enums and structs, operator overloading for math types (vectors, matrices) and better support among different compilers.

    So, although I consider myself a C++ programmer (it’s what I use almost always), I absolutely agree with Linus Torvald’s point of view on this issue.

  3. I am happily developing firmware in C++ in Instron: it is not only for high-level. Other areas, such as gaming, 3D modelling, real-time simulation need C++. Java, Python and C# cannot cope with the speed that is needed in such applications.

  4. The fact that there are a lot of C++ jobs out there and that C++ is widely used, doesn’t invalidate Linus Torvald’s opinion (or rant) against C++. At some point in history the majority of people thought the Earth to be flat and the Sun to revolve around the Earth.

    I’m a C++ developer, and I’m using C++, STL & Boost extensively at work, and with it we face a lot of problems that usually are deemed “a necessary evil”: hard debugability, deep inheritances for non shared code, large (massive) compile times, you name it.

    On the other hand, I’m involved on other projects that use a C like subset of C++, and yes, we face other problems (who doesn’t?), but compile times are down to seconds, code is straightforward and easy to debug, and programming is fun again! 😀

    Why a subset of C++ and not C? We basically use C, but a few features of C++ are nice to have: function overloading, no need to typedef enums and structs, operator overloading for math types (vectors, matrices) and better support among different compilers.

    So, although I consider myself a C++ programmer (it’s what I use almost always), I absolutely agree with Linus Torvald’s point of view on this issue.

    (I’m reposting the comment, since it looks like the first one was deleted)

  5. OO is just a paradigm; the language doesn’t matter. Personally I love C and C++ and have used them almost exclusively in my 15 years freelancing creating products for companies from fleet trackers to huge client server/db systems that are operating globally. Coupled with boost and QT I can write systems quickly, efficiently, and they will cross compile to several platforms (thanks to the free QT GUI library).
    Far too much credence is put into these paradigms, with developers trying to adhere to the “rules” and end up just hanging themselves (I went through that phase for a short time). Programming is easy, in any language. Good system design is what takes the brain power.

    • anacharsis

      MGB is right.

      Otherwise mathematics are easy and Hilbert’s “Grundlagen der geometrie” is Simpson’s hymnbook.

      Anyway you are right: your usual programing language restricted to your most comfortable subset is Heaven…
      Until a new paradigm arise to shake your brain, once again, with the same fallback…

      I started programing Algol60, and i’m still waiting for Revolution

  6. C++ is first choice when you need to support a bigger code base over a longer period of time, and cannot afford to rewrite your code or change your system build whenever a vendor decides they’d like to deprecate parts of their proprietary language syntax, deliberately changes APIs and so on.

    In such cases you’d definitely be looking for a standardized language that has some stability.
    And maybe you’ll find use cases for class templates, polymorphism and multiple inheritance, too, and start to appreciate getting compiler errors rather than run time errors.

  7. I think you are too much concerned about the importance of your own opinion and personality (as well as Linus).
    C++ was a huge milestone in the development of prpogramming languages and made a revolution in software development industry. It was a huge step ahead of C style development in terms of abstraction, design and the whole way of thinking about programming.
    Of course nowadays thinks have changed and new languages and platforms fitting a more soecific programming needs fill the market, but still there’s a huge amount of C++ job positions out there.
    You should at least respect this mighty language and point out specific reasons why you feel its approach is ugly.

  8. Joop Eggen

    Another argument against C++ was that introduced class hierarchies were often complicating a straight-forward further development of the code. True, at least for that time: weak IDEs, no design-patterns established and so on. That said, one might argue that C is just a higher assembly language, without the safeguards normally found in programming languages.

  9. C++ is an excellent option for a lazy dev w/no respect of system resources. It’s a lot like HTML. Vectors and cout make me puke. Linus Torvalds is a world class coder resposnible for a large portion of modern technology… who are you again?

    • Mikhail

      In response, I can say that global defines with names like m_data, m_thread in C code make me puke, especially when I define a local variable with the name m_data and try to find out why my program does not compile. C is not a language for be projects.
      There is nothing wrong with std::vector, but std::cout, I agree, needs some improvement to be more efficient.

    • But C++ has better resource management than C, doesn’t it? What am I talking about, C doesn’t have _any_ resource management. Maybe that’s why most C programs leak so badly or crash so easily… 😉

  10. Linus was and still is correct, in his obnoxious-and-want-to-punch-him-in-the-face-when-he-talks-about-anything kind of way. I’m a professional C++ developer as well.

    C++, God bless it, is today a middleware/library/abstraction oriented language. If you’re writing system tools – chances are that C is where you want to be. If you’re writing a GUI application – on Windows you’d want C#, on other OSes/mobile your mileage will vary but rarely will it be C++.

    Don’t get me wrong, I love C++ in that it has everything – and Linus the [expletive] pointed out that due to the realities of the ‘average programmer’ that this ‘everything’ is a ticking bomb of potential stupidity.

  11. Alejandro M.S

    C ++ is a very powerful programming lenguaje. The description of the PFF, kind of do not know what you’re talking. I’m sure that most drivers are written in C ++ and it is hard to understand, but it’s worth knows him

  12. I’m using C#, Python, Java, Scala, Octave and C++ at my work.
    But I’m still love C++, even not taking account “C++1x” extensions. C++ is a good instrument in a “good hands”.

  13. Anonymous Coward

    Honestly C++11 is not the same language as C++98. The idiom has completely changed since C++98. Resource (or Responsibility thank you John Kalb) Acquisition Is Initialization (RAII) have changed C++ from “c with classes” to a massively powerful language where the construction and destruction of resources is known at compile time.

    I would not call c++ object oriented and in fact use class inheritance sparingly (if at all). I would say it’s a resource/responsibility oriented language that just happens to have Object Oriented features that are convenient.

  14. Ten-Seng Guh

    When you have the expert and advocate of C++ Scott Myers calling C++ a “federation of languages”, you know it’s gotten way too bloated and complex. For anything C++ can do, a different language can do it better. C++ has survived because programmers often find it convenient to have a language that can do it all, albeit in not the most elegant way.

    • Mikhail

      Ten-Seng Guh wrote:”C++ has survived because programmers often find it convenient to have a language that can do it all, albeit in not the most elegant way.”
      C++ is the most popular language, which can easily be used for large-scale projects and provides speed, which is close that of writing in assembler (at least in most cases). In contrast, writing large-scale project in C is a nightmare..

  15. This is a horrible article. It’s made more horrible by the fact that a lot of substandard programmers read it, to the point where it’s much much easier to parroty a ludicrous generalization and cut & paste it. Quite frankly, any programmers who wasted their time reading this are diminished insofar as they could have spent the time improving their substandard skills. Still, those who can’t do teach, manage or squawk tripe like this.
    Slow news day, huh?

    • Steven Knudsen

      I thought it was a good article, because it generated a lot of good comments. I struggled with C++ until I read a textbook and (then later) learned more about “C”. I wrote the simulation code for my PhD using C++, and in particular used a lot of for the simulation itself and a bit of to build lists when setting things up (I didn’t know how many elements I needed, and I preferred just stacking and counting rather than counting up and then filling an array).

      Having the compiler for free under Ubuntu was wonderful. That having been said, I would use Python to build an interface, or maybe use QT Widgets (you can tell I haven’t made a decent interface yet … unless you count the command shell as an interface … (!))

  16. Stefano Zaglio

    An object is an expression of a class. The class is an expression of the mind of the developer.
    A function is such worldwide convention.

    The motitudine of modern languages exploded after C++. I do not know if it is the cause.
    A junior Ruby/Phyton/etc. programmer is better than my 20 years of experience in C / PASCAL / ASMx86 projects? Yes. Not probable but possible in this virtual world.

    C++ instruction hides the complexity of multiple C statements that hide the complexity of most assembler instructions. For me this job could and should be done by the IDE as it already does for the project and for many areas of the code itself.

    Each new language used to do the same things destroys the achievements of the previous generation, slowing the evolution, to the benefit of big software producers.

    Linux Kernel, libZip, libPNG, XBMC(KODI), etc. are surviving even if base on a language of 40 years ago.

    I look like a conservative, but I would love to have a constructor, a destructor of structure, operator overloading and write pStruct.member instead of pStruct-> member.

    I would prefer that the simplicity of the developers of middle land as me, win the war between super genius and spaghetti-coder.

  17. DuskoKoscica

    Well, noting is perfect and nothing is forever.
    C++ was in problem with multithreading, and in my opinion it is not solved still, and it looks like it might be one of the last trains for that one.
    One good thing about it is now we have the standard for it and people need time to adopt new ways.
    There is to many things to be improved still, after all.

  18. knuckles

    Made a career with C++. Still nothing better for scientific programmer, game engines or simulation. Speed and abstraction.
    Yeah, it can be a mess and it is definitely not the most elegant collection of tools. Somebody once call it a family of languages.

  19. CodeJingle

    14882:2011 also supports a built-in wrapper for automatic memory management, for those who want to use it. C++ is actually fine for system level code. As we get closer to the metal we make less use of the higher level features of C++ and may use custom allocators for STL. We may even have and use an equivalent of the standard library and STL that is return-based instead of exception-based. Only the barest bare metal routines like bootstrap are arguably best written in ‘pure’ C or assembly. C takes just as many steps as C++ to be translated to executable machine code, so C++ in not inherently more complex than C. Microsoft developed COM originally for C to add polymorphism and VTBL support to the language since it wasn’t built in. Companies had to manually add all of the extra layers to C to get what is built-in to C++. C++ was born out of a need for that extra functionality. C++ exists in its current form today by the combined efforts of all the top C programmers who were tired of having to manually add and maintain the same frameworks in every job and every project they worked on. The people who hate C are looking backwards at the process that caused it to come into existence and what led to its current incarnation.

    • CodeJingle

      I meant ‘The people who hate C++ are looking backwards at the process that caused it to come into existence and what led to its current incarnation’. And I hear Linus is a bit of an ass, so take his complaint with a grain of salt.

    • I actually write firmware for AVRs in C++. Yup, I had to so some template meta-kung-foo, but I don’t regret it. Now I can do something like this:

      auto buzzer = MCU::b_2; // High to enable.
      auto bubbler = MCU::b_5; // High to enable.
      auto heater = MCU::b_4; // High to enable.

      MCU::b.configure_as_output_exclusive (buzzer, bubbler, heater);

      compiled to two assembler instructions. Or other individual operations like this:


      This is way more expressive than some magical C bitwise operations AVR encourages in their datasheets. And exactly as efficient as it would be in C. So… yes, C++ can be even used in super low-level microcontrollers that have 2 kB of flash and 512 bytes of RAM. Works very well for me.

      • And in case you wonder, MCU::b_* are static constexprs of a Pin class. MCU::b is static constexpr for a B port. I can use those as normal objects, too (copy them, for example, pass to a function). Then of course I’ll have an overhead of an object in RAM. But that isn’t really needed in case of programs for microcontrollers…

  20. Contrary to popular belief, C++ *can* be very usefull when writing very low level, very resource-constrained code, in a re-useable way. Not by copying the standard customs and patterns used for less resource-constrained programming work, but by carefull use of for instance templates.

    • Germán Diago Gómez

      Well, that is what you say… D is nice, but it cannot replace C++. On top of that, D requires a garbage collector in the runtime, by default. The closest thing I see that could replace C++ are Rust and D, and both are going to suffer a lack of libraries and tooling compared to the state of the art in C++. I tell you from experience, because I am a person who has used C++ since 2002 and in all my jobs, besides personal projects.

  21. I honestly feel that poor programmers with little training will make a mess in any language c++ or not.

    Experience of previous mess encountered by others or made by yourself gradually forms you into a good programmer if you have any sense.

    Know the all features of a language – but only use them where necessary – not just to get it on your CV. Making it simple, concise, well named and well organised and it will maintainable.

  22. Too many idiots out there that just don’t know how to use C++ and jumped on various bandwagons of the hundreds of new ‘languages’…
    Good riddance – go play with your silly toys and imagine you are a bad-ass software engineer. 🙂

    Saying that, there are other decent languages out there of course, but it is not the reason to dump your spare shit onto languages you don’t use or don’t understand.
    I feel disgusted with these people (including myself when I’m doing the similar).

  23. 0xDEADBEEF

    “That latter concern aside, though, this is the 21st century: Why write dozens of lines of code when a single line of code (as with C++) will do it?”

    Are you implying that nowadays compact and efficient code doesn’t matter? Are you implying that you can get away with the usual high-level language bloat in embedded systems?
    I think not… The worlds isn’t only cloud computing and tablets and phones and similar shit… There is a huge, flourishing embedded world out there you might wanna explore one day. And there is a reason C++ isn’t supported that well in that world because it produces BLOAT. And that ONE line of C++ code is enought to do the damage and make a hard real-time task miss its deadline.

    • Germán Diago Gómez

      The good thing about C++ is that you can restrict it to not use the heap (new) or produce that mighty bloat code you are talking about. You must know what you are doing, but it can be achieved and it is not rocket science. I cannot say the same about D, with a plugged-in GC in its runtime. Let’s not talk even about C#/Java, there is no contest. C++ is all that C is, but better. Of course you can mess it up, but this is like driving a car or driving a plane: you can drive the car more easily, but when you drive a plane you can make long distances faster.

  24. well I have started with C was not charmed by C++, had to used , because of clients. saw java popup somewhere in the 80’s never liked , had to use it, and so on and so on. in 34 years of automation yes you hear it.. not IT , there was a big come and little go of programming languages, most of them are still around. bottom line is : popularity of programming languages are driven by the crowd, claiming it to be good, or great to use. Each language will have it’s booming period and will not be used for it being good or bad by the crowd , but rather get interest because the crowd will talk about it. so bottom line is I grab whatever language I find suitable for the job in the client environment and programmers have their choices,

  25. By all means, C++ is ingenious, but Linus certainly has a point here. Also, there are millions of schoolkids and students and engineers and scientists out there who need simple programming to a) figure out some numbers b) draw graphs out of them. I do anything in that area under 2-3000 lines with TrueBASIC (certainly not for programming Mars Rovers or cellphones), allowing to build any kind of graphs with PLOT x,y or PLOT x,y;u,v, having one single kind of numerical variable (53+11 bits) and dynamic sizing of screen windows etc. etc. Our company’s principal programmer curses his C++ every time he sees my 10 line-graphics stuff and compares it to the size of his (excellent) C++ graphics. I am disregarding differences in speed here.

    BASIC in itself was formulated by two TEACHERS (professors Kemeny and Kurtz). Many of the languages of today are written in order to write a new programming language (to exaggerate a bit). An analogy: Many languages are like buying a Bugatti Veyron or Jaguar E-type or Ferrari or Mercedes Maybach as your first car when you would get by with a bicycle. AND: learning to drive a bike first certainly wets your appetite for trying out the Bugatti some day! (Hope you notice I list no American cars among the silly ones. That is after owning a row of Cadillacs myself. I am European). Jumping right into the E-type when starting one’s programming career may be a bit intimidating. The learning curve for the E-type rises for a couple of years before you are anything like productive, you learn the elements of riding the bike in a week.
    Do not misunderstand me. I deliberately go a bit off the original point here. I have the highest respect for the people providing us with Microsoft Office ( I write large optimization spreadsheets for optical design in Excel), Autocad, CCleaner and what have you, all using C++. True BASIC is written in C++. I am just talking about the equilibrium between the demands of the users not needing iron-level crunching and the level of resouces available.

  26. wow what a clickbait headline. So what you’re basically saying is “Linux was sorta wrong about C” But in your last paragraph you admit that C has it’s place for system level programming.

    So what again was it that Linus does? From his perspective (as a system level programmer) his argument was more than valid (albeit a bit strong…But than again he is known for his strong oppinion).

  27. Si1ver1ock

    C++ requires decent high quality libraries like POCO. I used to use boost. It was quite painful at times. Some libraries like Spirit or Wave I never really liked very much. High level MPL Template programming can be a pain, especially when the compiler pukes up a type identifier three or four lines long. I went template crazy for a while (thank you Alexander Andrescu), but found it hard to initialize templates buried deep in the hierarchy. Also, every time you instantiate a temple you implicitly create another type, the compiler does if for you in the background–until it pukes all over you. One of the best books I read on C++ was Large Scale C++ Design by Lakos, which I should probably re-read. If you are writing largish C++ software systems without reading this book, you should probably save time and just shoot yourself.

    The easiest and best boost libraries were were accumulate, random, date_time library(I liked the idea of date_time iterators.)

    POCO has networking and XML, Smart Pointers etc. It is more like what you would expect a user level library to be. If we had more libraries like POCO C++ would be a much nicer language to use.

    The lack of a GUI can be gotten round by using a app hosted popup webserver with a Ajax/Javascript base GUI. POCO comes with a server library. I wish POCO had better RNG support and date iterators.

    I have been writing a lot in C# lately which brings its own “Joys.”

  28. Daniel Canham

    You miss the main issue with C++, it is a jack of all trades, master of none.

    Most projects find themselves in a 80/20 position where the problem space is suited to a specific domain;
    – prototyping
    – performance
    – safety
    – utility
    – etc..

    While c++ can accommodate these areas, it performs none of them well.

    Prototyping should really use javascript & node with react framework. One code base running on server & client and it works.

    Performance, hell java beats c++ in most performance areas now.

    Safety, haskell, nim, etc…

    utility, python and ruby have most environments beat

    C++ simply does not excel at anything and the price you have to pay for the baroque syntax brings the cost of using it up too high.

  29. Wouter van Ooijen


    I could argue about the areas you mention (java beats C++ in performance? Sure, that’s why supercomputer simulations are all written in Java!), but what about an area you don’t mention: programming small microcontrollers?

  30. C++ is a bag of things. Some of them are useful, but some of them are like a gun in the hands of a kid.

    C++ does not support embedded programming better than C. The STL gives you fully dynamic vectors, but no range checking for static arrays. You can do anything on your own …

    Inheritance and templates can make your code explode. So do initializers and deinitializers to your run time. Its easy to loose control over the properties of the code in C++.

    Since the is no way to limit C++ to a save set for kernel/embedded programming, i can understand Linus rant. You can do a lot of real time programming with C++, but it bites. And you will not know when and how.

    If it does not matter when your program delivers and correctness of the answers is not a matter, C++ is ok. Having initialized variables, range and assignment checks and limiting assignments between different types helps a lot to avoid errors.

  31. duskoKoscica

    Yeah, it should be about facts not story telling, because C++ is not history still.
    There are some things that should be done in different way, perhaps, but it is still one of the most popular languages.
    It is about time to create better things for Multithreading thing, and there are still places for some other languages, because C++ could be not so productive, and there is some problems for some apps that are for bussines applications, like standard for graphical user interface.

    And it looks like some people have issues with C++, and its legacy from C…

  32. duskokoscica

    One more thing.

    I have faced few situations in which I would like to create functions in program run, within a string and then execute that string or something like it is a function or method.

    If you work with mathlab you have something like: A.+B, A.+B, A.-B, A./B … to implement that thing it would be enough to have two for, something like this>
    for(int i=0; i<n; i++)
    for(int j=0; j<n; j++)
    C[i][j]= A[i][j] operator B[i][j];

    As you might notice only thing that is different is operator, is it possible to create function in run time and then execute it.
    Yeah, I know I could use different overloaded operators or different methods or perhaps one function and then I pass that argument: +. -, *, / etc…
    And there are few more ideas, however I am still looking for something like that…, I was thing to use ## like concatenation of parts or something like that, but I have not found right thing, till now.

    Could somebody really help with this!

    • one approach to having MATLAB like features in C++ is to use valarray. Just google “valarray dot product” and you’ll get some ideas.

      Another approach is to use , which is part of the standard C++, as in std::vector.

  33. WorBlux

    IOKit uses emdedded C++ which is a subset of C++ which is notably lacking in multiple inheritance, namespaces, exceptions, and templates Additionally many users make a point to avoid using the STL library.

    Additional problems of using C++ include lack of portability. There is no standard binary interface for C++ so it’s impossible to link code using different compilers. Also a handful of architectures don’t have a C++ library due to their minimalistic design. If you want a widely portable kernel you are limited to C.

    And is should be noted that the kernels that make use of C++ aren’t entirely C++ and have C parts at the core of the design.

  34. Ben Black

    I am using c++ to write a artificial neural network library, and I have found that for the vector operations that form the core of the logic, the obvious c++ constructs are way, way too slow. In order to get anywhere close to acceptable performance, I had to throw out even the vector class, and use basic pointers, AVX intrisics and hand unrolling. I tried wrapping the intrinsic code in c++ template classes to allow for neat and easy code writing and editing, and found seriously inconsistent results across compilers. In other words, c++ was not right for the job.

    However, when using the library in some sort of application, I can think of no better language to use than c++, as its code tends to minimize overhead and a lot of other libraries which one may want to use to help in an AI task are also written in c++. Someday D or Rust or some other compiled modern language may take over c++’s middle ground, since c++ admittedly is a ridiculously complicated language that has some awful backwards compatibility issues and excessively verbose syntax, but for now, those other languages cannot compete with c++ libraries.

  35. I’ve been writing software for over 40 years. The projects that used C++ were just the worst to work on and a complete maintainence nightmare. Not quite as bad as java though.. but close.