5 ms·
I’m glad someone is having fun in C++. Personally, after >20 years, I have to be done with C++. It’s just a mess. If I really need the low-level control, I can
by xorvoid 2y ago
I’m glad someone is having fun in C++. Personally, after >20 years, I have to be done with C++. It’s just a mess.
If I really need the low-level control, I can wrangle C (warts and all), otherwise Rust, Python, etc just make me happier.
- pjmlp 2y agoBeware of C23 and later. C is basically going into "we want C++ but without OOP and with templates done via _Generic". Also LLVM and GCC aren't going to be rewritten from C++ into Rust anytime soon.
- bilekas 2y ago> Also LLVM and GCC aren't going to be rewritten from C++ into Rust anytime soon. I'm afraid you underestimate the will power of rustaceans to find literally anything to rewrite.
- pjmlp 2y agoI doubt Cranelift will ever match the only project that has beaten the contribution level of Linux kernel.
- cornstalks 2y ago> Beware of C23 and later. Beware of what? C23 fixed a number of issues. Sure, there are some oddballs (QChar and auto, mostly), but overall I think C23 is an improvement.
- pjmlp 2y agoThose C89 hardliners have a different point of view. Also there is the whole point Objective-C and C++ are much better than those improvements will ever be.
- motorest 2y ago> Those C89 hardliners have a different point of view. C89 was only a thing because Microsoft somehow decided to drag it's feet and prevented msvc from supporting anything beyond c89 for a long, long time. Only in 2020 did they manage to finally do something about it. https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/ https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-...
- pjmlp 2y agoBecause for Microsoft C belonged into the past, it was about time to move into C++. https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/ https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-an... They only changed of point of view after Satya, and the whole Microsoft <3 Linux and Microsoft <3 FOSS pivot. And in any case, blaming Microsoft doesn't really work out, as many of those folks don't even care Windows exists, only UNIX/POSIX platforms.
- janice1999 2y agoI imagine most C programmers are still using C99 or older anyway, particularly in the embedded space.
- ericbarrett 2y agoI'm not sure this is still true. I'm just a hobbyist but esp-idf, for example, supports C++23.
- TJSomething 2y agoesp-idf is still on GCC 11, but most of the features of C23 are in GCC 13.
- phkahler 2y agoC99 or newer. You gotta have standard fixed size types like int16_t.
- bcrl 2y agoNot in the embedded space. When you've worked on embedded systems long enough, you learn that you have to accept the compiler that the vendor provided you with, and you adapt your codebase to the limitations of that compiler. This means working around code generation bugs, adding #ifdefs to define typedefs for things like int16_t if they don't exist. That said, things are a lot better than they were 15 years ago, and the mainstream ARM compilers used today are leagues better than the barely functional cobbled together ports from the early '00s. ARM64 is a tier 1 platform, and there are enough users of the platform that the extended QA team that embedded developers were unintentionally part of in the past is no longer really the case (at least when it comes to the compiler). However, there are still truly obscure architectures (mostly 8 bit and 16 bit) that continue to have oddball compilers. And you accept and deal with that insanity because it means you're only paying $0.01 for that microcontroller to blink an LED when some kind of an event occurs.
- uecker 2y agoWhat part of C23 makes you believe this?
- pjmlp 2y agoEverything that was taken from C++, and _Generic. And the ongoing discussion for lambdas that didn't make it into C23, but still on the table for C2y. Meanwhile, zero progress in what actually matters, proper strings and arrays, that aren't a continuous source of memory corruption bugs.
- uecker 2y ago_Generic is from C11 though. For array I wonder people don't use them more. After all, array access can easily be bounded-checked in contrast to pointers. I essentially eliminated all my spatial memory bugs this way.
- yodsanklai 2y agoAgree. C++ is here to stay though. Too much code written in that language. It's certainly a great skill to have, and there are super lucrative jobs too. For me, I feel the language just go in the way and is way too complex. Sure, I know the discourse: "modern C++" is great, you don't need to learn about older. versions of C++, things are getting simpler with each new version. The problem is that the codebase you get to work on aren't modern C++. They use every possible feature ever released and it's just hard and full of pitfalls. I suppose people who have only work on C++ in their projects for years can develop some level of expertise and are immune to the complexity. But really, not a great language...
- jandrewrogers 2y agoOne of the things that has made C++ more tolerable over time is that it became easy to seamlessly replace most of it with an implementation that works the way you think it should and with most behaviors being fully defined -- the core data types, standard library, etc. Particularly with C++20 and later, alternative foundations feel quite native and expressive. Most new C++ projects I see lean into this quite heavily. The ease with which you can build a systems-level DSL for your application is a strength of C++.
- mst 2y agoThere's a parallel here with modern applications perl as compared to the crawling horrors people perpetrated in CGI scripts during the dot com boom. Also present day javascript (the language; the ecosystem is another matter ;) compared to the 'var' and IIFEs-for-scoping era.
- motorest 2y ago> I'm glad someone is having fun in C++. Personally, after >20 years, I have to be done with C++. It’s just a mess. I've spent a couple of decades working with C++, and the truth of the matter is that, as much as it pains the bandwagony types, C++ became great to work with once C++11 was rolled out. The problem is that teams need to port their projects to >C++11 and that takes an awful lot of work (replace raw pointers with smart ones, rearchitect projects to shed away C-style constructs, etc) which some product managers are not eager to take. I firmly believe that the bulk of this irrational hatred towards C++ comes from naive developers who try to rationalize away their lack of experience by blaming everything on the tool. On top of this, cargo-cult mentality also plays a role. What makes this quite obvious is the fact that the solution presented to all problems always comes in the form of major rewrites, even with experimental and unproven features and technologies. Writing everything again is always the solution to everything. Everyone before them knows nothing whereas these messiah, cursed with being the only ones who see the one true answer, always have a quick and easy answer to everything which always boils down to rewriting everything from scratch with the flavor of the month. Always. Weird, huh?
- ModernMech 2y ago> C++ became great to work with once C++11 was rolled out. The problem is that teams need to port their projects to >C++11 The problem is the C++ that's not great to work with is still there, and there's nothing preventing the rest of the world from using it; there are always going to be naive developers with a lack of experience who don't know how to use the tool. For this reason, all the code that's possible to write in C++ will be written, that includes the unsafe code. It's not enough to have a safe, nice, modern, subset of C++ that everyone "should" use. If developers have the option to use the warty, sharp, foot-gun infested version of C++ they will, and they will gift that code to the rest of us in the form of readily exploitable software. This is why organizations like CISA are suggesting developers move to other languages that take a stricter posture on memory safety: https://www.cisa.gov/news-events/news/urgent-need-memory-safety-software-products https://www.cisa.gov/news-events/news/urgent-need-memory-saf... > companies should investigate memory safe programming languages. Most modern programming languages other than C/C++ are already memory safe. Memory safe programming languages manage the computer’s memory so the programmer cannot introduce memory safety vulnerabilities. Compared to other available mitigations that require constant upkeep – either in the form of developing new defenses, sifting through vulnerability scans, or human labor – no work has to be done once code is written in a memory safe programming language to keep it memory safe.
- markus_zhang 2y agoI take a few features from C++ in my C++/SDL2 Ultima spinoff project -- never completed sadly. Class, std::function, std::unordered_map, std::string, std::unique_ptr<type> are the only ones that I could recall. I can't imagine reading other people's code though, unless it's in a similar style. I did find that the most difficult part is to get past the programming patterns (such as Visitor pattern) as I don't write large programs professionally. I wish C++ stopped at C++/11. The committee seems to want to include everything into it at the moment. Maybe C++ is sort of ULTRA programming language that supports every niche programming style.
- jandrewrogers 2y agoFWIW, C++20 is a much tidier and more usable language than C++11. The difference between C++11 and C++20 is almost as large as C++11 and legacy C++.
- markus_zhang 2y agoThanks, I briefly read the changes on cppreference. It's a good list (although I don't get many of the points as I'm an amateur) but I think my small project doesn't benefit a lot.
- tcbawo 2y agoWhat is your Ultima spinoff project?
- markus_zhang 2y agoAh that was my pet project to create an engine that runs a game similar to Ultima 1-3. I even used the Ultima 4 sprite sheet. Never completed it though.
- mort96 2y agoC++ is an absolute mess. But it's a fun mess, and I like writing in it :) Sometimes, that's important. My relationship with, say, Rust is much colder: I respect Rust, I use Rust where I think it makes sense (especially in e.g professional contexts where I often can't defend the use of C++), and I think what it's doing is important. But I find it tedious to write, despite having a fair amount of Rust projects under my belt at this point. It's better in key ways, but not as enjoyable, for me.
- scotty79 2y agoRust is fun for me but I keep it high level with Rc and built-in data structures. It's fun thinking about variables as little boxes of fixed size that values get moved into or out of. It's so different than almost any other language where stuff lies often god knows where and is referenced ad nauseam. Although that can be fun too if the language treats mutability as exception rather than a rule.
- amelius 2y agoSame. I wish someone made a better C++ from a blank slate. And no it's not Rust.
- zahlman 2y agoIs Rust not meant to offer the same kind of control and "low-level-ness" as C? Like, can't you cast integers to pointer explicitly if you break the `unsafe` seal (and thereby e.g. do memory-mapped IO to control hardware)?