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.
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.
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.
Tbh I never expected that experiment to go anywhere. I guess that leaves Carbon (and large scale efforts to rewrite C++ in Rust).
Whereas one kind of works (VS), there is apparently no work going on VSCode Intelisense, ticket is stalled since January, and the promised announcement never came up.
Nobody has said they are using them in anything important, but hopefully that is coming.
Chromium is gonna be more conservative than that for sure.
Why? It doesn't remove complexity, it (partially) hides it and makes the whole thing even more complex.
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.
-Werror might help with that
Looks like someone fell for the C abstract machine trap yet again. No, C is isn’t an abstraction of the machine.
I couldn't do that with mciropython on any platform.
C is a thin abstraction, python isn't.
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.
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.
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.
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.
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.
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)
Unreal Engine depends on C++20 at this point.
https://dev.epicgames.com/documentation/unreal-engine/epic-c...
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.
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.
How is that different from other languages, which don't need the brain warm-up?
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.