I very strongly disagree. It’s practically a superset for backwards compatibility reasons but modern C++ coding patterns are vastly different to C. Modern English is kind of a superset of Shakespearean English, but you don’t need to know it for most daily tasks. C++ is much more elegant and safe when avoiding C patterns. C has its place and I use it sometimes, but the two should absolutely not get confused because of the name and compatibility.
Well, I mentioned safe in the comparative degree. Modern C++ could be actually safe if you restrict yourself to a subset of it, that’s sometimes not really practical. I do think that things are improving and with C++26 it’s becoming way easier to write perfectly (memory-)safe code that’s also (subjectively) elegant.
The C++ spec is absolutely massive. Nothing says elegant like a million different ways to do something.
Python works pretty well and doesn’t have to much overhead. Sure it doesn’t have the same performance as C/C++ or Rust but most of the time you don’t need millisecond level code.
You are supposed to use shared_ptr (automatic reference counted pointer) and unique_ptr(statically checked unique pointer) and not create raw C-style pointers anymore.
It still has a lot of weird niche cases that need to be avoided, but memory management is definitely much easier, so in many ways it’s safer at runtime than C, while being still much more obscure than C.
I still agree with you that a more modern language would be even better, especially for learning!
I tried that 20 years ago and it was a massive waste of time. Spend a few days to understand pointers, then embrace modern C++ with the STL, it’s safer and more productive.
Also cout is dead, you can use print, println, and format now.
Props to you for learning C++, its a neat powerful language, although it has grown quite overcomplicated through the years.
Though if you want something a bit easier, you can also use Python for Qt development through the PySide6 library. It is one of the officially supported Qt languages alongside C++ and JS. I’ve personally used it for a few programs and it works wonderfully, it is one of my favorite ways to make GUIs for myself, it just works™
This is not true. Both ISO C++ and ISO C have have features that are not available in the other language. Therefore, there is no subset or superset relationship.
I would tweak this recommendation. If you want to start with C, consider writing C-style code into .cc or .cpp files, and compile as C++. You will therefore be learning “C++ with functions only” as opposed to “C with classes.”
At uni I was taught C++ first (all the basics, logic 101, control flow, pointers, etc). Then I was taught data structures with C the next period (linked lists, stacks, queues, a tiny bit of trees…). Then I found out I sucked at maths and switched to graphic design!
All in all OP is in for a hell of a ride - yeah you could just start with C but they could start with C++ too so just to get the feel of it.
True, it was just a recommendation because for me it made more sense this way around. Like objects are just structs with function pointers and some compiler magic to ensure private and publicness, polymorphism is just unions etc.
As C++ is a superset of C, I reckon you should start with C, as many concepts of C++ are translatable to C, which is what the first C++ compiler did.
I still use fprintf instead of cout because it feels more “proper”
I very strongly disagree. It’s practically a superset for backwards compatibility reasons but modern C++ coding patterns are vastly different to C. Modern English is kind of a superset of Shakespearean English, but you don’t need to know it for most daily tasks. C++ is much more elegant and safe when avoiding C patterns. C has its place and I use it sometimes, but the two should absolutely not get confused because of the name and compatibility.
C++ is a lot of things but elegant and safe are not words that come to mind. C++ has far more issues than regular C.
Best option would be to use something with memory safety
Well, I mentioned safe in the comparative degree. Modern C++ could be actually safe if you restrict yourself to a subset of it, that’s sometimes not really practical. I do think that things are improving and with C++26 it’s becoming way easier to write perfectly (memory-)safe code that’s also (subjectively) elegant.
The C++ spec is absolutely massive. Nothing says elegant like a million different ways to do something.
Python works pretty well and doesn’t have to much overhead. Sure it doesn’t have the same performance as C/C++ or Rust but most of the time you don’t need millisecond level code.
I do agree and I think it’s wise to narrow C++ down by a lot, and that is a choice you can make when working on a new project.
Modern C++ changed a lot!
You are supposed to use shared_ptr (automatic reference counted pointer) and unique_ptr(statically checked unique pointer) and not create raw C-style pointers anymore. It still has a lot of weird niche cases that need to be avoided, but memory management is definitely much easier, so in many ways it’s safer at runtime than C, while being still much more obscure than C.
I still agree with you that a more modern language would be even better, especially for learning!
It is still massively bloated
I tried that 20 years ago and it was a massive waste of time. Spend a few days to understand pointers, then embrace modern C++ with the STL, it’s safer and more productive.
Also
coutis dead, you can use print, println, and format now.That’s what I tried to get started with, but I wanna make programs with qt6 and the qt creator doesn’t support it so c++ it is
Props to you for learning C++, its a neat powerful language, although it has grown quite overcomplicated through the years.
Though if you want something a bit easier, you can also use Python for Qt development through the PySide6 library. It is one of the officially supported Qt languages alongside C++ and JS. I’ve personally used it for a few programs and it works wonderfully, it is one of my favorite ways to make GUIs for myself, it just works™
This is not true. Both ISO C++ and ISO C have have features that are not available in the other language. Therefore, there is no subset or superset relationship.
I would tweak this recommendation. If you want to start with C, consider writing C-style code into .cc or .cpp files, and compile as C++. You will therefore be learning “C++ with functions only” as opposed to “C with classes.”
At uni I was taught C++ first (all the basics, logic 101, control flow, pointers, etc). Then I was taught data structures with C the next period (linked lists, stacks, queues, a tiny bit of trees…). Then I found out I sucked at maths and switched to graphic design!
All in all OP is in for a hell of a ride - yeah you could just start with C but they could start with C++ too so just to get the feel of it.
True, it was just a recommendation because for me it made more sense this way around. Like objects are just structs with function pointers and some compiler magic to ensure private and publicness, polymorphism is just unions etc.