4 ms·
This kind of post is why I do not understand C++ programmers whatsoever. It's basically a demonstration of the absurd amount of time C++ takes away from you by
by garrisonhh 3y ago
This kind of post is why I do not understand C++ programmers whatsoever. It's basically a demonstration of the absurd amount of time C++ takes away from you by being the moldy pile of shit that it is. You want better compiler checks and less freedom? Great, me too. Can we please shut the fuck up and use a language that actually supports that?
- lionkor 3y agoIt simply has too many upsides and is way too popular to be replaced with either - a simpler language that does less - a less popular language - a more verbose / restrictive language If you want people to switch to something better, make something better. Its not enough to simply call out the issues (which is valid, but not useful anymore), and it entirely dismisses that replacement languages like D (small, less active ecosystem) and Rust (hugely verbose and equally bloated) do not actually service the entire range of C++ users. If all the other compilers and languages were THAT much better, they would be used. For a lot of apps, Rust has been that replacement, but not for all domains C++ is used in. Why do people still use telephones when calling via whatsapp, telegram, element or discord exists? Why do people still drive shitty motorbikes when electric cars exist? Why do people still write by hand when you can type instead? Because the replacement is not a complete replacement and does not actually work better for everyone.
- jokteur 3y agoI like the idea of Rust, the tooling, the package manager (far more better that what you can find in C++). What you are saying is true: I've been writing high performance scientific code and desktop gui apps. I would love to use Rust for my projects, but it just doesn't cut it. The libraries I am using are very mature in C++, but the libraries in Rust to accomplish the same thing are still too immature to consider in my projects.
- jenadine 3y agoOut of curiosity, what are these libraries that are missing equivalent in Rust? Also, can you not use these libraries from Rust?
- pjmlp 3y agoNot the OP, however here goes a quick sample. Anything related to HPC and HFT, CUDA, game engines (Unreal/CryEngine/Ogre3D/Godot vs Bevy), Qt/WinUI/MFC/VCL/FireMonkey/wxWidgets/KDE, COM/XPC/Binder, compiler frameworks (Graal/GCC/LLVM). Yes, many of those could be used from Rust, some of them already are, provided there are bindings, then again it is the classical question if one wants to maintain bindings, or write the application they care about.
- memefrog 3y ago>If you want people to switch to something better, make something better. We already have C, which is better. It existed before C++. It will exist long after C++ is dead. If you don't over-architect and over-abstract your code you can be more productive in C than in C++ precisely because you avoid the kind of nonsense that this article (and the endless other articles about overcoming C++'s shortcomings and cognitive overheads) talk about. In the time you spend waiting for C++ code to compile, you can instead just write more code in C. Look at all the articles that get posted here about C++. There was a post a day or two ago about trying to work around C++ compilation times. How long does it take to compile C projects? Not long at all, if you follow standard rules that have been well-known for decades like forbidding #include in header files. >If all the other compilers and languages were THAT much better, they would be used. Argument from popularity/Blub paradox. If C++ is so good why does it need to be constantly updated and extended? If you think C++23 is better than C++20, then surely you accept that C++23 can at least potentially be worse than things that already exist. --- People have an attitude towards C. They think "oh but what about std::vector? I will have to write my own containers". But 90% of the time you will have good enough or even better performance with a few lines of code. Often you know statically the maximum size and can just allocate that at compile time, or you know before filling a collection what the size will be. In C++, most code dealing with vectors that I have seen pre-sizes the vector anyway. That could just be a 'malloc' or a static array. The result is that you compile in debug mode and your program actually works, you can use a debugger, everything Just Works. Programs run at almost full speed in debug mode, and debuggers work. It's glorious. In C++, you spend a hundred thousand lines of code reimplementing standard library containers anyway because anything more complicated than std::vector is unsuitable for non-trivial programs, and then the only way your program will run is with optimisations on, because your 'zero-cost' abstractions are actually very high cost if you aren't compiling with -O3. Oh yay I have a big standard library in C++. Thanks for saving me from having to use the old ugly BSD sockets API to do networking. I can use a nice modern networking API in C++. Oh... it doesn't exist? Oh well, I'll use a nice modern filesystem API in C++. Oh, it only was added recently and lacks basic functionality? Oh well, I guess in return for learning the 50 different ways of initialising a variable, and all the subtleties of argument-dependent lookup and glprxvalues and template deduction guides and template⟨T=std::enable_if⟨std::is_void⟨void_t⟨int⟩⟩::type⟩::value⟩ I will get the benefit of using a high-quality standard library that contains std::regex and std::random and std::chrono and std::thread and std::vector<bool> and std::unordered_map and all the other VERY high quality standard library facilities provided by the C++ standard library! Oh they're all crap. Pity.
- hdjfkfbfbr 3y agoC++ is terrible language.
- lionkor 3y agoCare to elaborate?
- rewmie 3y ago> This kind of post is why I do not understand C++ programmers whatsoever. It's basically a demonstration of the absurd amount of time C++ takes away from you by being the moldy pile of shit that it is. What? Exactly what led you to think that nonsense? A random blog post of someone misusing lambda expressions? There are plenty of things in C++ to criticize, but a) you are not actually criticising anything at all and instead spewed just noise b) misusing a feature is not a problem of C++.
- Kranar 3y agoThis isn't a random blog post and the techniques in the blog are actually used by the standard library and some pretty major C++ libraries such as range-v3 and fmtlib. The author of the blog post is in fact one of the authors of fmtlib. Getting libraries to play nicely with ADL is actually a huge pain in the ass and in fact the three major C++ compilers don't agree with one another on how to actually perform name lookup in a large number of cases.
- jb1991 3y agoDon’t waste too much time trying to convince the commentor, as they have a history of accusing people of “spewing noise” in threads about C++.
- keithalewis 3y agoWhat a well thought out and considerate post! HN needs more people like you making such valuable contributions.
- nothacking 3y agoHonestly these are issues introduced by C++, and avoidable by using C.
- deterministic 3y agoC++ is one of the most successful programming languages in history. It makes all new languages look like a drop in the ocean comparatively. Millions of professional C++ developers work on large scale mission critical C++ code that control everything from airlines to Fortune 500 companies to cars to nuclear reactors to military hardware. And new C++ projects are started every single day. Most developers have zero clue on what it takes for a programming language to be successful in the real world. And they have zero clue on how much $ and time it would take to rewrite the billions of lines of C++ code out there that runs the world.
- Conscat 3y agoImo, rewriting the code isn't the only prohibitively difficult problem. Replacing the very advanced development tools C++ has seems almost impossible, and so far no competitor to C++ has come very close, and it's a moving target. You can debug template instantiations over the GDB remote protocol, you can print out an AST and make queries on it (much richer than Tree Sitter), you can generate a perfect callgraph (understands templates, overloads, and macros) with no effort, you can get suggestions for source code optimizations at the IR bytecode level, every hex editor or whatever can demangle C++ symbols, you can print out the ABI of any polymorphic class or use a bin introspection tool to do the same in reverse, you can organize template compilation errors into one of several easily navigable GUIs, you can JIT C++ code in a REPL or a debugger and place breakpoints on templates or overload sets or exceptions, you can extend linters and compilers with plugins, and C++ has some of the most advanced static analyzers of any language (not just systems level ones). The closest overall in tooling IMO is Rust, but it's currently missing a lot of the above, and very many C++ abstractions cannot be elegantly expressed in Rust due to limitations in generics, const functions, the orphan rule, and a lack of C++-like functor structs.
- deterministic 3y agoYep agree. Most HN developers work on comparatively simple JavaScript CRUD business applications and have zero clue on what it takes to write the large scale high-performance software the world relies on to function.