3 ms·
Personally I don't find programming with C++ that hard. The downside is it needs a brain warm-up, and this is per project, but once that flywheel is spinning, I
by bayindirh 5mo ago
Personally I don't find programming with C++ that hard. The downside is it needs a brain warm-up, and this is per project, but once that flywheel is spinning, I find it almost effortless to write code.
I have to go through the same warm-up more or less for any language I work with, so it's not that different than writing Python, Go or Java for me.
- jdw64 5mo agoThere are so many standards and idioms that it gets confusing. There are still legacy codebases out there — some codebase still use C++98 as their standard, others use C++11... And with Unreal Engine, the modern C++ standard is C++14, right? There are things like smart pointers, but some places don't even use them. I feel like there are just too many features. When I saw template metaprogramming — that new feature — I realized I have no talent for C++.
- bayindirh 5mo agoI have developed things with C++98, C++11 and C++14. Every of these standards are so vast, so remembering everything (even in a single standard) is not possible. Instead of knowing everything, I first fix the standard I want or need to work with. Then I design the thing I want to build. I always design what I want to build beforehand. This takes a couple of iterations from high level to low-ish level. That last design becomes a bit language dependent. Then I select some of the core tools that I'm going to use (which kind of pointers, classes or structs, etc.) With that design in mind, I go "library shopping" both for file formats (if any) or other stuff like vectors, etc. Armed with the reference docs of these, I write my code with the toolbelt I have built for the project. Some things are hard, but they are not impossible. I find thinking like compiler helps a lot.
- flohofwoe 5mo ago> When I saw template metaprogramming — that new feature — I realized I have no talent for C++. It's not a new feature. And tbh, compared to Typescript, C++ templates are tame ;) (but yeah, deciding when to stop digging into the template metaprogramming rabbit hole requires some common sense and sanity, too much template complexity is almost never worth the hassle)
- bregma 5mo agoIt was a new feature. Over 30 years ago now. Template metaprogramming was even featured in the ARM.
- maccard 5mo agoThis is true of any language. Python with flask vs django, with/without type hints. JavaScript with anhular and vue. The varying standards are no different to major python versions or go versions - arguably there’s even less between most versions than there is in your average go release. The differences in apps and frameworks don’t matter for day to day - std::string, Unreal’s FString and QT’s QString all are similar enough that 99.9% of the time. Metaprogramming is one of those things; you either write it or you don’t. Knowing some basics is required but the vast majority of people use a handful of pre existing things without understanding the nuances of how it works under the hood.
- tralarpa 5mo ago> This is true of any language Is it? Java has changed a lot, but in such a way that it's still easy to mentally map new features to the old ones, provided you have understood the core language. IDEs can even convert your code from old to new and back.
- xonre 5mo agoStill true for C++. Can still mentally map new features to the core language C. A modern Cfront transpiler can still be written. Template meta-programming maps to C pre-processor macros. The sad part with both is generated code cannot be examined thus the unreadable compiler errors and slower compilation as it's regenerated every time. Slightly off-topic: Rust can also be mentally mapped to C.
- maccard 5mo agoYeah it is! Java 25 changed constructor behaviour to allow logic to run before the calls to super(). That’s an enormous change. On the c++ side, “modern” features like span, smart pointers, range based for loops, format are all really simple to reason back to for anyone who is a programmer. Stuff like modules and concepts is a bit different, but most people aren’t in the innards of those every day, in the same way that the change in header size doesn’t affect every single Java developers code, but you should know about it.
- justin66 5mo ago> And with Unreal Engine, the modern C++ standard is C++14, right? Unreal Engine depends on C++20 at this point. https://dev.epicgames.com/documentation/unreal-engine/epic-cplusplus-coding-standard-for-unreal-engine https://dev.epicgames.com/documentation/unreal-engine/epic-c...
- jdw64 5mo agoWhen I went on a business trip for screen golf program project back then, it was UE4(CPP14), By your introduction UE5 onward, it's 20. I've updated my knowledge.
- lelanthran 5mo ago> The downside is it needs a brain warm-up, and this is per project, but once that flywheel is spinning, I find it almost effortless to write code. How is that different from other languages, which don't need the brain warm-up?
- bayindirh 5mo agoThe difference, if you split hairs, that the brain warm-up takes a bit longer. Maybe a couple of hours, or a day at most. Otherwise it's not different for me. I don't feel different while writing with any other language. I guess the main reason is I always think like the computer first and translate that thinking to the programming language at hand.
- whstl 5mo agoI find C++ not hard at all when working with familiar idioms, restrictions and toolings (familiar to me). But it's hard jumping into new codebases and adjusting yourself to new patterns. Recently I did a lot of programming using C++23 Modules and it was a breeze. There's basically dozens of very nice languages inside C++. That can be a blessing or a curse. I'm anxious for Herb Sutter's CPP2/CPPFront to become a standard.
- domenicd 5mo agoWhat type of project actually uses C++ 23 modules in real life? What kind of toolchain enables that? When I worked on Chromium, they were indefinitely in the "maybe in 5-10 years the tooling will be ready" camp.
- whstl 5mo agoYC startup. Toolchain was Clang and sh. Chromium is gonna be more conservative than that for sure.
- bluGill 5mo agoThe tooling people have - as of about a year ago said they are ready. Now everyone who considers themselves early adopters is using then. Most are waiting for the early adopters to figure out what the best practices are so we don't make a mess
- rustyhancock 5mo agoI agree. You don't learn or know C++ in the way you learn or know C. You never have the total language spec in mind. Much of it you will never (and for some of it should never) come across. The way I think of it C is an abstraction of the machine, so thin it's nearly transparent. C++ is an abstraction over programming paradigms, letting you pick how you think. Everything else abstracts the machine away, replacing it with a VM, runtime, or model of its own. The same way a good project has a clear model of the problem it should have a clear C++ pattern in use.
- techbrovanguard 5mo ago> C is an abstraction of the machine, so thin it's nearly transparent. Looks like someone fell for the C abstract machine trap yet again. No, C is isn’t an abstraction of the machine.
- poncho_romero 5mo agoC Is Not a Low-level Language: Your computer is not a fast PDP-11. https://spawn-queue.acm.org/doi/10.1145/3212477.3212479 https://spawn-queue.acm.org/doi/10.1145/3212477.3212479
- bayindirh 5mo agoAs a corollary, all processors are C VMs, anyway.
- skydhash 5mo agoIt may not be an abstraction of a real machine. But the C abstract machine is very close to the foundational idea of how a computer work. And it’s quite easy to bootstrap.
- rustyhancock 5mo agoImportantly my work involves me often being able to look at C and think about the assembly and back and I regularly work on ESP32, ch42(riscv) and atmega avr8. I couldn't do that with mciropython on any platform. C is a thin abstraction, python isn't.
- xedrac 5mo agoI have felt this many times. However, the effort involved in writing code does not indicate the amount of issues that code may have. This is why I prefer Rust to C++ these days - it just removes 90% of the development tail, which can be quite long in C++.
- bayindirh 5mo agoThat’s true, however I tend to build my testing harnesses alongside the code I write, hence every single function and the whole flow has a testing suite ready almost immediately (via Catch2 99%of the time), and every commit is tested locally and by a couple of runners after the commit. This coupled with generous amount of Valgrind testing allows me to catch problems early and fix them immediately. Doing this allowed me to write very performant code without any leaks or accuracy problems. Another thing I do is making some cases mathematically impossible. If this promise is broken, code is guaranteed to crash at that point, so it’s self verifying in a sense. Of course enforcement of this is possible due to fact that I code solo most of the time, and has the discipline to do boring things as well as the exciting and fun things.
- Brian_K_White 5mo ago"I don't find programming with C++ that hard." That's the easy half. The old joke used to be that perl is a write-only language. Hell the way I write bash is pretty write-only (basically golf). I'd say so is C++. A lot of things are easy to write and then impossible to read or develop.