The day I gave up on C++

C++[This is an article written in 2013. Things have changed, not a lot, but they have. Every time someone discovers this post via reddit I feel like taking it down – it’s not particularly good, it was written when I was quite upset with my lack of ability to become productive in C++. I will not bother you with the updated view, and I will keep the article because people seem to stumble into it every now and then, probably because they are equally frustrated and, like me, they didn’t know how to express it. I am tempted to do a rewrite of this, though (and I have)]. I wanted to mark this somehow, in my calendar or something. I always liked C++ as language, it was nice to build so many nice things with it. I learned C++ when I was in 11th grade, and I kept learning for years. Probably everything that I know about design and design patterns I pass through the C++ filter. I map all the things I learn in all other languages through C++, and understand them better. I must confess, I always loved C++ like that.

But, C++, this relationship doesn’t work anymore. It’s no longer love, and before we split I want to tell everyone why:  You’re ugly. You wanted to be a splendid girl, and borrowed the flexibility of your older sister, C. You just wanted to do too many things. You grew up among bearded fellows that made you do all the wrong things, like your sister used to do. But it didn’t work out that well for you. And I was younger, didn’t know better, and I fell in love. But the thrill is gone, now.

A famously quoted joke is the following: what is the 11 in the C++11? It’s the number of feet they glued to C++ trying to obtain a better octopus. Of course, it didn’t work.

And I must confess, C++11 looks tempting. If you write your code from scratch, C++11 might be an option. But when I say from scratch, I really say from scratch. Write your own libraries for everything. And for Christ’s sake, replace completely the STL! Boost? Don’t make me laugh. Boost is a Vernian, submarine sized octopus that is out there to kill you.

Let’s take my reasons one at a time:

C++ IDEs suck. Big time. I tried about 10 IDEs in the last two months. They all suck big time. Not only do they suck, but they are counterproductive: Visual Studio the absolute best IDE when it comes to C#, wants to make a point from actually sucking in an equal quantity for C++. Eclipse made me cry, netbeans sucks, kdevelop sucks, code::blocks sucks, codelite sucks, monodevelop sucks and whatever you might suggest that is the next best thing in IDE sucks too. Trust me. Now, I know, this is not the language’s fault. But you’d expect that after all these years of experience, of needs for C++ support in IDEs, you’d see some improvement. No, the IDEs become proud in sucking more each year in their C++ support (of course, Eclipse does that for all the languages, but that’s a different story).

It’s an unmanageable language. You have header files split from source code. Why? Because in the 70s and 80s it was difficult to have proper metadata in object files. For C, it makes sense: it makes writing a compiler a lot simpler, if you don’t count the number of people that killed themselves after writing the preprocessor of C. But we understand C. C is cool. C is simple. C is meant for other stuff. But in C++, header files are the rope that you hang yourself with. You don’t want to include the same header file two times, so you use, what? Header guards? #pragma once? All these are error prone (#pragma once for not being supported by all the compilers). So what do you do?

It’s a barely portable language. If you want to write things portable you have to #ifdef stuff. This, of course, makes your source code ugly. Right now, C++ is less portable than Java or C#, that really have this ‘write once, run everywhere’ thing.

It’s a counterproductive language. The real reason for me being so upset with the language is the fact that the language constantly gets in the way of my project. I started working on my own game ladder, and wanted to start with PONG. Easy, right? Wrong. It’s almost impossible to understand how you keep in standard containers objects created by some libraries. And when the standard library is the obstacle, it’s definitely an issue.

Talking about STL, STL sucks. I know, it’s the fastest and sharpest knife in the kitchen. But it sucks. It sucks because it is so intrusive in your code, because you never know if you should create containers on the heap or not, it sucks for the uninspired names and for the unstructured approach to the containers. You don’t have an ‘Add’ function, instead STL has a push_back, but not for all containers. No, for stacks you’ll have a ‘push’. ‘Remove’ is called ‘erase’, and the ‘remove’ you see there is not what you expect: you have to use erase with the result of remove. You don’t have a unified interface for containers, and you can’t simply say: I want something that I can enumerate, which is what you want most of the times.

The focus on performance actually makes STL impracticable. STL is optimized for the compiler, and it’s counterintuitive. And some smart-asses will say: use boost instead. Boost is smart. No, sorry. BOOST SUCKS. Boost is the ugliest piece of software ever created. It’s useful, but ugly. And no person alive could ever cover all of Boost libraries. Why would they? Ah, they have to, because IDEs will never ever ever help you with that.

And let me mention the namespace stupidity. Because STL is so bad, boost and others create their own containers. The best toolkit to use with C++ is by far Qt because they rewrote everything from scratch. But the problem is that you will have constantly nameclashes. So, I C++, it’s bad manners to use the ‘using namespace X’, especially in the headers. Which makes quite common definitions like:

Call me when you get what I have there. Compare this with List<Drawable>, and let me know which is better.

The language sucks. It sucks because it’s so complicated. C++11 managed to complicate it even more, and now you often wonder how many ampersands you have to place in your constructor? STL is unusable, is counterproductive and makes your programs unreadable.

Any beginner will be crushed by the statements C++ programmer have to write. So from now on, I will recommend to any beginner to jump from C to C# or Java. It makes much more sense, really, do it.

And I say this with great regret in my heart. I always loved you, C++, as ugly as you were. But now the thrill is gone: you became unusable and counterproductive, and I really have no time to write proper containers in 2013.

Comments

The day I gave up on C++ — 73 Comments

  1. One of the reasons IDEs suck is that the language is complex. It’s incredibly difficult to do something like Intellisense in a language like C++ (much easier to do it for java or c#).

    • Correct, but we’re not talking about two years, we’re talking about 20 years of IDE development. Microsoft constantly made theirs worse, and the rest seem to follow this trend as well.

    • Oh ok! Do you find VS 2012 worse than VS 2010? Just wondering if I shouldn’t upgrade then.

    • Since I did my tests with 2012 and became this upset…
      2012 is a good IDE, but not for C++. Can’t compare with 10, since I didn’t use it for that

    • Did you try the “Visual Assist X” plugin? It’s awesome. At least for me it really made a difference when using C++ in my projects. It’s “almost” like ReSharper. True, it’s still a plugin and not an IDE, but it’s an option.

      PS: Also, you could try Qt Creator, last time I used it it could make non-Qt C++ programs too.

  2. I recommend looking at Haskell. It will blow your mind from the start but each time you’ll code in it you will fall more and more in love with the language.

    And you won’t even need IDEs. A simple Vim editor will be just enough.

    • I’m thinking about that too. But now I’m a bit disappointed, and I’ll take a break from these things, hoping to find a warmer spot in writing. But I will definitely investigate Haskell too, I’m quite drawn to the functional programming paradigm.

    • Code becomes complex.
      Instead of one’s computer,
      Choice words get scattered.

      Writing turns awful.
      Instead of desperation,
      A switch to coding.

      The wise strategy
      Instead of stability
      Becomes flexible.

      This is not the Tao. But it is close enough.

  3. I know that you are an anti Apple type of guy, but if you find some time take a look at Objective C. I started to like it even if I still love Java 🙂

    • I will not invest a single cent in the platform of Apple 🙂 It took me a while to be ok with Microsoft; really, don’t get me started on Apple’s platform.

      If you want to check out a wonderful language, C# is the one. 😉 and maybe Haskell 😛

    • I was there, I know. You know me, I am a Java guy, I use to have the second android Phone On the market. But, ar least you should give it a try. It is something else, It was the big surprise for me, a pleasant one…

    • I’ll take a look at Haskel, I heard a lot of good things about it…

    • Microsoft are a dying behemoth. There’s absolutely no future whatsoever in Windows as a platform. End of story.

  4. @Timotei: didn’t try visual assist X but, on the other hand, I don’t have the full Visual Studio (I only use the Express version, I don’t want to pay hundreds of dollars on the IDE that I’m not sure I’ll want to use). It does sound promising. Still, it’s the language that is the culprit.

    The same goes for QtCreator. QtCreator was nice, it was the good part of Visual Studio 6, improved, so I liked it. But still, it doesn’t help me much, because in the end projects built with it are kind of ugly, and the project management part is not as good.

    And for crying out loud, there’s no good cross platform compiler to support all C++11. Don’t get me started on MinGW and how much it sucks, and cygwin, which are trying to be the oldest piece of software alive, and the fact that VC++ 11 doesn’t even have initializer lists. Seriously?

  5. c++ is complex because it support multi-paradigms, each paradigm have its own merits and defects.I like multi-paradigms philosophy in c++ because I don’t have to “reinvent” the wheel when I need them.When I use other language without template like c++, I have to “mimic” template in c++, because they do not support generic programming, template help me reduce codes when I develop algorithms.

    c++ is complex, but we don’t need to learn all of it, ch1~ch16 of c++ primer 5 are more than enough for most of the tasks.

    c is too low level, c#, java are not fast enough for foundation softwares(libraries), and they are own by specific company.Whether you like it or not, c++ is irreplaceable.

    >And no person alive could ever cover all of Boost libraries
    nobody could ever cover all of java, c#, python libraries too, but why should we?just pick the one you need.

    >Talking about STL, STL sucks
    stl is not perfect but still cool and easy to use, efficient, and flexible(generic).”push_back” or “add” is not a big deal, the names is impossible to fit the flavor of every programmers.Atleast I like “push_back” more than “add”, I can know the data “push” to the
    back of the containers but not “add” into “every possible positions”.”insert” the data at front, back or other position are crucial for the performance to some containers(vector, queue)

    About the remove, it is a reasonable design choice for a generic algorithms, the algorithms is impossible to know how to “erase” the data of “unknown” containers.The containers could be everything.

    >std::list<std::shared_ptr> x;
    most of the times we would declare something like “std::vector x;”
    It is a rare case to declare something like std::list<std::shared_ptr>.
    Besides, you could use
    “using DrawList = std::list<std::shared_ptr>;” to save some typing

    • I agree with your points, however, the problem is that we always have to give in to one or another style that we dislike. So if, for example, I don’t want to use pointers, only copies of objects, then it’s impossible to do it if one or another library requires pointers. There’s no unified model; a unified model would help especially library implementers, to make them work together well. If you want an example of this: should I have std::list ? should it be std::list ? Should it be std::list> ? Will QWidget be destroyed at the correct time, or will it cause my application to crash on exit? And now the most important question: WHY do I have to ask myself about all these things?

      That makes developers hesitant until they develop a style, then acrimonious when relating to other styles. How will that developer work in my team?

      And remember, it’s not about saving some typing. It’s about understanding what that thing is. That’s what types are for.

      PS: lists are ideal when your allocation is O(1).

    • About the problem of “should it be std::list” or not, it don’t looks like a problem of c++, but a problem of data structures, it is a fundamental problems every programmers should learn from the schools or books.If they don’t, teach them or fire them.There are not “unify” containers for every jobs, and no “unify” paradigm fit for every tasks.It is a big loss to restrict the power of the programmers by making the langauge with a “unify” paradigm.

      pointer is good to access the data but not resource management, just wrapped it by smart pointer if you want to make sure the resource could be release.

      And the resource management, to tell you the true, I like the way of “RAII” more than the manage language.

      1 : I know the life times of the resource
      2 : I can guard every resource by RAII, not just memory(mutex, file and so on)

      After you grasp the idea of RAII(it is simple), resource management in c++ is like a piece of the cake.

    • I like the fact that we’re not disagreeing here. Although I think that some sort of unification would be quite helpful, maybe for a higher level data structure. I really do appreciate the flexibility of IEnumerable.

    • Forgot to say, std::list are very inefficient(low cache hit), especially when c++11 support rvalue reference.It is only suitable when there are many(the number is depends on machine and compiler) data which need random insert.

  6. >It’s a barely portable language
    just use the right libraries for your need, like Qt.It is hard to argue whether c++, java or c# are more portable, it is all depends on your requirements.My android apps developed by java can’t work on windows, mac, ios and linux, but most of my c++ codes could works on the platforms I mentioned above, only a little bit alternation on the codes(#define).

    • yeah, I don’t like macro too, but this is the best way in c++, I have to bear with the merits and defects of every language when I use them.No perfect language in the world.

  7. The main problem with C++ has always been its complexity. Some people see the multi paradigm approach as a strength but I think that a language that tries to do everything in the end not is good for anything. Sure, C++ 11 has simplified a lot but on the other hand: here comes yet another way of writing code in C++. Using a subset of the language could be a solution but people never seem to favor the same subset and without strict coding rules (and reviews) the code base will quickly degenerate to an unreadable mess of different styles. As the author I really do not see any domain where you would use C++ these days.

  8. Any language with header files sucks. I’ve spent too many precious hours of my life chasing circular includes and putting forward class declarations in header files and I’ll never get them back. What a precious waste of life.

    • Sorry, but when you’ve got circular references, that probably means your design is broken 🙂 So the header files “sucks” actually warns you that “you’re doing it wrong”.

  9. “C++ IDEs suck.” – Couldn’t agree more. There’s no decent C++ IDE on the planet. Period. That’s why I use vim, youcompleteme which is based on clang to get semantic code completition, and rtags for jumping to definitions, which is, again, based on clang. Guess how fast my IDE starts? If you’re on linux terminal write “vim”. Yeah, that fast.

    “It’s an unmanageable language.” – Oh really? 😀 Because commercial games do it, huge projects do it, Qt VERY SUCCESSFULLY did it and, somehow, it’s unamanageable? Or maybe you need to learn manageability yet?

    “It’s a barely portable language.” – Fair point. But isn’t sometimes QTcpSocket same on linux and on windows? Shouldn’t you rely on a library for portability if you don’t want to deal with it yourself? I mean, yeah, someone else did the dirty job for you, but ain’t that the same for java where portability is also done for you?

    “std::list<std::shared_ptr> x;”

    So… I guess you don’t want to write typedef once if you use it many times?

    typedef std::list<std::shared_ptr> PtrList;
    PtrList x;
    PtrList y;
    PtrList z;

    “C++11 managed to complicate it even more”

    Yeah, I’d much rather write
    std::vector::iterator i = v.begin();
    instead of
    auto i = v.begin()

    🙂

    • I really should update this post 🙂 But I understand your criticism; however, I recommend you try to use Visual Studio and C#.

  10. Yeah, this post says it all. I came here being frustrated with CodeBlocks because it sucks so much. It’s not just the intelisense. It’s to the point I want to strip it of all its “functionality” and leave only syntax highlighting, the build settings and file navigation.

    I’m sincerely amazed by how much these IDEs suck. Netbeans has a terrible font support and is outstandingly weird to set up libraries in a project. I couldn’t bear to read the text so I switched to CodeBlocks. CodeBlocks code completion is an huge piece of shit. It makes no sense at all.

    It just shoves closing brackets and new tabs without thinking twice. Neither of those have a non-intrusive way of showing spaces and tabs. And the CodeBlocks GUI is basically pumping the window full of new menus, floating panels and tabs for plugins used for stuff I honestly have no idea about.

    Then there is QT creator. I don’t have tabs. What. The. Fuck? To think I would find a multiple document interface program in this decade without tabs?!

    The IDE support really, really hurt me. I’m giving up on this shit. I don’t even know as much as you, but I already know C++ is just not worth the trouble. This is just too much bullshit.

    People need IDEs for their C++ to fix the problems in the language, like header guards. So I’m really fucking amazed that IDEs have made it such an overly complicated task to create a header file. Like CodeBlocks needing you to actually open a save file browser to do it. This is stuff the developers of the very CodeBlocks would have to deal with on a frequent basis, to think they would leave it like that just confirms that these IDEs are seriously trying to outsuck eachother.

    I’ll give up on C++ too before it’s too late. I just have to find a replacement language to program games.

  11. Your sample code (std::list<std::shared_ptr> x;) raise an error on my compiler because it misinterprets “>>” as shift operator. Indeed C++ is not nice (I know it’s just a typo, but I hate to put space between ‘>’). I found Python and lua is kind of nice language. Especially lua is work fine with C so I can use it for built-in scripting stuff. I tried Haskell but It was too difficult for me 🙁

    • @hoge: It’s not a typo. You need a C++11 compiler for that to properly compile.

      However, there’s a certain appeal to C++ that makes me come back to it, again and again.

  12. @there’s a certain appeal to C++: it’s the power of it. yes, its’ complicated, it’s a behemoth, is full of quirks and bad legacy. but is as sharp as it gets and it would blow up your leg if you ask for it, without begging (that’s the main critique that I have against c++: i like the ability to blow up legs, I would just like it to not be there *by default*, but that’s another story. And truth is, the language itself is becoming better, basically C++11/14 is a new language that just happens to be bckward compatible with C++03. And I am looking forward with eagerness to modules and scope_guards (unwinding_exception) in C++17 (and, I hope, even earlier). In the meantime, you could have a look at the D programming language (dlang.org).

    • C++’s new developments sound promising, especially the modules proposal that hopefully will catch wind for 2017. The modules and a proper IDE will make C++ a desirable language. 😀

  13. About the IDE support for C++ discussion: It’s indeed a valid question why it wasn’t done (well) so far. My opinion: simply because the effort to do it so is not worth it (for the IDE developer). Make no mistake: developing an ‘intellisense’ like tool for C++ is orders of magnitude more complex than doing the same for largely context-free languages such as Java or C#. I’ve worked with several people on this topic (R. Raggi from Nokia, working on QtDevelop; Scott McPeak, who laid the foundations of what is now LLVM/Clang, used by OS X; Taras Glek from Oink/Elsa, to mention just a few; also developed/sold tools that do that, google for SolidFX). Bottomline? (a) Developing a _strict_ syntax/semantic analyzer for C++ is about 10x harder than one for C#/Java; (b) Developing a _fuzzy_ analyzer for C++ (needed for understanding potentially incorrect/incomplete C++ code) is about 5x harder than (a). Is this a problem of C++? Not really I think. IMO, if you want to have a more expressive (read: context-dependent) language, like our own spoken languages are, you have a (big) price to pay. Sure, if you’re OK with a less flexible language (read Java/C#/etc), no problem: all is simpler, but then the programmer’s expression freedom will be inherently limited.

    Apart from this, tech rant: GLR (Generalized Left-Reduce) parsers are STILL relatively new. And parsers with a feedback loop to semantic analyzers are also not mainstream (dudes still learn that you have to use lex/yacc to build a FULL parse tree and only THEN do semantic analysis). Well, good luck building intellisense-like features for C++ with that.

    • @Alex: Still, C++ was here for 30 years now. The C++ part of Visual Studio, about 20 years. I would’ve expected some better support, if you understand what I mean. It’s true that it’s harder, but even so…
      Anyway, as I think I repeated through the comments, I will probably not give up on C++; it’s just tough love. After all, beautiful code can be written in any decent language, and C++ makes no exception.

    • @Peter: I’ve come back to C++ because I like to see its evolution. I’m not convinced that there’s any other language that can offer the same performance, and I think that C++ goes in the right direction, especially after I’ve seen the modules proposal for C++17.

      But truth be told, I’ve come back to C++ because I haven’t been really awed by other language, that would really solve my grievances. And since I use it as a personal projects language, I’m fine with it; after all, I know it well enough.

      There is some other rationale as well: while most languages will try to hide the machine from me in nice abstractions, C++ allows me to see exactly the cost of what I do. Sometimes it’s a good reminder.

  14. C# native (called Roslyn project) is the END of C++.
    Open source .NET platform is the END of JAVA.
    Period.
    It’s just a matters of 1/2 years.

  15. I have not yet given up on C++ completely but I’m having loads of fun replacing serious pieces of code formerly trainwrecked in C++ with much more maintainable Elixir/Erlang.

  16. I agree with some of your points, however, I would like to give my opinion about the matter:

    – I agree that the language is already very complex, and now even more with C++11: type deduction (all of them, see https://www.youtube.com/watch?v=wQxj20X-tIU), initializer_lists (everything about them),… Though, as time goes by, I don’t see it as a problem anymore, it’s simply the way it is.

    – Rvalue references were VITAL, it was simply ridiculous that you had to store noncopyable objects in the heap simply because of a language flaw (wasn’t C++ all about efficiency?) in order to store them in stl containers.

    – The STL sucks, agreed (though I don’t fully agree with some of your reasons), and I hope the whole Ranges thing will put some remedy.

    – Also take a look on iostreams… The API is inconvenient (though definitely an improvement over the printf one, which cannot be extended easily for custom types), its error handling is archaic, its performance is so bad that people don’t use it (http://channel9.msdn.com/Events/GoingNative/2013/Writing-Quick-Code-in-Cpp-Quickly?video, http://ericniebler.com/2013/11/07/input-iterators-vs-input-ranges/).

    – However, I don’t think Qt fares better: I think the majority of its duplicated functionality (containers mainly, because QString has some raison d’être) should be deprecated, QScopedPointer refusing to take advantage of move semantics is simply ridiculous,… and they OUGHT to start using exceptions as a saner and proper way of error handling.

    – Btw, Boost is AWESOME (though it’s just a matter of taste), you don’t have to use all of it, and I very much prefer the standard versions where available (std::unique_ptr, std::optional,…), but it definitely has raised the bar in API design on the C++ side.

    – The preprocessor sucks SO MUCH, which is probably the main reason that we still don’t have a proper module system in C++.

    – BUT, the worst thing in C++, its biggest flow once you get through all the complexity IMHO, is that as of C++14, we still don’t have a standard ABI, which means that you have to expose a C api, which sucks; or else having to compile zillions of versions of your library (taking into account OF COURSE different compiler settings). That’s why some library authors prefer header-only ones, which increase significantly compile times.

    • @Alex: my opinions might have been a bit toned down after a while, although I haven’t used C++ for a while now. Currently I’m working on an embedded solution, and I’m still pondering if I would choose a C++ based solution or a C# based solution. My experience with C# was quite good, and I feel that I never been as productive with C++.

    • I think STL will be greatly (I mean GREATLY, GREATLY, GREATLY) improved with the arrival of Concepts Lite.

    • @Alex P: The lack of ABI is also a kind of politics. To make long story short, as long as there is no ABI, the language is inconturnable if one has to extend a codebase already in C++. This ensures C++ is needed. Throw in an ABI and suddently tyou could use Java or whatever in order to extend the same codebase. Principles are one things, realpolitik is another thing. Note that I don’t take sides, just expose the understanding of the situation.

  17. Hi guys, what about C++ Builder XE IDE? I like delphi and c++ builder very much! They are elegant!

    But sadly, they are windows only though they can develop cross platform apps.

  18. In the case you need to write a native program, you can intentially limit yourself within a subset of the C++ language, which is much easier to write and much less nonsense than in pure C.

    I learned this language a few years ago before C++11 was published, but this new standard made me feel like it’s faster to learn a different language than to add these new additions to my mind. However, you would not feel like so if you always only use a subset of the language, e.g. limited usage of template, exception, etc. This is also what the GCC project has done: http://lwn.net/Articles/542457/

  19. i’m an expert in C# and wanted to learn vc++, so i was quite surprised by how much documentation sucks and the whole thing is complicated, the language is not that hard to learn but naming conventions suck, header files suck and everything you have said.

    i was searching online to see if others share my concerns, you should be given a medal since you summarized everything i feel now.

    MS corrected everything with .NET but they left VC++ fucked as shit, even errors that popups up in errors list suck, 99% of the error message is fucking symbols and shit qualified by header names and namespaces that you cannot understand a shit. i spent 5 mins to understand the overloads of a function from the intellisense as the tppltip is filled with fucking symbols and no direct understandable function parameters like C#.

    it really hurts me to see a wonderful languages that is actually the mother of all languages get fucked like this.

  20. You spoke earlier about that other languages are not amazing you. That’s what I feel myself. They look like pampering difficulties instead of solving them.

    Still… I admit that one language out there, aside C++, amazed me: is Rust.

    I don’t really like it’s syntax that much, but I like it enough.

    It is like C++ with unique_ptr and const by default, but also with null-dereferencing compile-time error and so on.

    A bit of static analysis would do almost the same over C++, especially in analysing the lifetimes. Still, the C++ would need a “unique” keyword, as Bartosz MILEWSKI was hinting at.

  21. I spent the last hour trying to work out why:

    typedef std::map<int, int> TABLE;

    void f(const TABLE&) {…} ;

    const std::map<int, const TABLE> tables;

    const auto table = tabled.find(i);
    f(*table);

    Doesn’t work. At this point, I just don’t care — the STL and C++’s slightly weird definition of const is getting in the way of me getting my job done. I’m going to try striping the consts out to see if that helps (heaven knows, instantiating my tables object in the overall class’ constructor required sacrificing some goats), and after that I may just use something different entirely.

    I’ve been programming as a hobby for about 25 years and professionally for 10. I’ve used piles of languages. C & C++ have some unique things going for them… but they are such a pain in the ass to get anything actually done in. I’m currently paid to work in C++; I think for my next job I’ll look for some other language if I can manage.

    Wonder if I could convince my ‘but it’s soooo faaaast’ coworkers that we should port to a faster language… like Fortran. Probably shouldn’t, they might just say yes.

    • Worked it out! map.find(x) doesn’t return an iterator to the value in the map associated with x… it returns an iterator to the std:: pair(x, value). So that last line should have been:

      f((*table).second)

      To which I can only reply, f– the C++ STL. Yes, you can do some interesting complex things this way. Was it really worth making using maps unintuitive worth it?

      That’s an hour or two of my life I’m not getting back.

    • Another hour, another piece of horror worked around.

      typedef map<uint, map<uint, uint>> MAPMAP;
      const MAPMAP immutable;

      This doens’t work:

      MAPMAP& mutable = const_cast(immutable);

      This does:

      MAPMAP& mutable = const_cast<MAPMAP>(&immutable);

      Screw it, I’m plucking my eyes out, abandoning my career as a programming, and taking up a simple life as a blind goat herder.

  22. Edit: That should have been:

    MAPMAP& mutable = const_cast<MAPMAP*>(&immutable);

    Forgot the extra * in my const cast example.

  23. Well since you like C# so much, let me tell you something about C#, every time MS releases a new version of VS and C#, you will have to buy a whole book in order to know every new functionality that C# has, and sometimes its not the libraries that change, but the core language itself! I wonder, how are you .net guys productive with such a language, that changes at every release! And yet you consider C++ as having to much features…
    Not to mention, the funny relation with open source, and even if you could mention mono and stuff, but MS can kill them and all of they users if they want to, they only have to start using the patents they have over .net.
    And, just for that C# isn’t more portable than C++, unless you consider the world only as MS platforms, in that case you’ve got so much to learn.
    But, you are right on boost, that is probably the worst piece of software written for C++, that thing is a huge hack and exploit of C++ standard and compilers.
    Also you’re right on editor support, and the fact that no one does it right not even YouCompleteMe, since that even if using clang its clever, the wrapper around it is constantly crashing.
    You’re also right, when you talk about the #include kludge, and that it would be much more easy if C++ just used modules and require as a keyword.

    • I wouldn’t overestimate the desire of Microsoft to get back to the blood-sucking image they created for themselves in the late 90s. C# is quite a healthy language and it doesn’t grow THAT much. There are very few features added over the years, even if the framework grows.

      Do not mistake the framework for the language. I don’t like the framework much, only parts of it (the System parts).

  24. To my mind, OOP is a bad attempt to create 3D objects in the flat world. We have got binary data, but need to define copy constructor. If one object not equal even in one byte, why it is a copy? It is stupid to my mind. More calls to memory allocation in ‘new’ will create a lot of fragmentation and garbage collection. What is the price for such memory management? The price is bad multicore support. It is too big price. Abstraction reduces functionality. Hiding methods will activate unexpected usage. So, every programmer must understand full functionality any way, to avoid unexpected usage. And if so, why I must use abstraction? It solves nothing, on the contrary creates additional problems. In C I can define struct. Inside struct I can define massive pointers to functions. First parameter for function can be pointer to struct type. Second parameter can be any I want. Why I must use a lot of inheritance, templates … for a simple things? Is it only for wasting time? To test program I will need to create 2 in degree of amount ‘if’ inside a program for test combinations. Why I will need to add extra ‘if’ from parsing xml? I have got enougt test combinations without parsing. For 32 ‘if’ I will need to check 4294967296 combinations of input data. Even if I will spend 5 sec for each test combination, I will not be able to finish work. Nobody live so long 🙂 How are they going to use jUnit, if they add additional ‘if’ for debug test system? Are they crazy? Will OOP reduce number of ‘if’ statment? No.

  25. Pingback: Why C++ sucks (2016.02 edition) | dorinlazăr.ro

  26. Pingback: Why I haven't given up on C++ - IT大道

  27. I’m a professional programmer with HUGE EXPERIENCE and what i have to say is: “C++ IS NOT FOR EVERYONE 😉 !!!”
    I have been programming for at least 11 years in C, C++, Java, C#, PHP, Javascript, Shell and BASIC so may i’m right for what i say: “C++ IS NOT FOR EVERYONE !!! “

  28. FORTRAN, Algol, BASIC, assembler [various], C, C++, Javascript, PHP, Java etc

    I’ve programmed in all of the above since early the 1970’s and each has strengths and weakness etc.

    BUT only C/C++ is a real system / application development language. It’s an open standards language and is not owned by any big che$$e either. Although I do fall asleep if anyone starts on about some of the darker [obscure] areas of C++ and some of the new ‘fancy’ who-the-f##k-asked-for-that and what-the-hell-does-it-mean bits that people seem to want.. If you can’t manage with classes, file i/o, sockets and maybe a GUI and graphic lib then you are being a bit precious.

    Trust me I’ve spent many a project working with people who feel weak at the keys at the sight of a command line and would panic without a mouse. Bless them.

    I would not like to write an OS, or decent AAA game, or a fast and efficient cross platform data server or any mission critical application in any other language.

    Fair enough there are some who love Java for things like Android apps [which itself sits on top of an OS written in C/C++] etc and some will love the niche or propriety languages [ micro$not c$$ anyone ?].

    Anyway that’s enough from this old dog and good luck to all you new puppies, enjoy it all.

    I’m off for a walk to visit another tree.

    woof

  29. I wonder about what you said about the IDEs for C++.
    Since you said you don’t like these IDEs, I wonder what IDEs you do like and why?
    What would your perfect dream IDE be like? What features would you like it to have to make you pelased and satisfied?
    And what exactly are the things you don’t like about current IDEs?
    (Hey, maybe it’s a good idea for an article? The pros & cons of IDEs.)