Lurker News
In the recent years C++ received a lot of backlash due to its complexity and (perceived) feature creep. However, since C++11 I really enjoyed writing C++ with its strict type system (including const), range-based for loops, smart pointers, and how much you can do with templates. On the other hand, I know that it can be very tricky to write, for instance, a correct iterator, to get handling of rvalue references right, or to read error messages that involve templates.

So, do you enjoy or dislike writing C++ source code and why?

Comments (93) 66 threads

Show all comments

Showing thread 2 of 66

chris_j1 reply#
I'm really torn about C++. I love C++ but there are things that I really don't like about it as well. It's a fantastic language in a lot of ways, but it carries around 40+ years of cruft, of things that you wouldn't do like that if you were inventing a programming language today.

I haven't written C++ professionally for many years at this point, and my memories of using it professionally (pre C++ 11) are not happy ones: having to agree on a strict subset of the language that we were allowed to use, which avoided features that any of the compilers didn't support well, or that my teammates didn't like. Sadly back then the list of forbidden features included templates and namespaces.
But using C++ on personal projects nowadays, and being able to choose which bits of the language to use - and which to avoid - is much more enjoyable. And honestly, the language did get a lot better from C++ 11 onwards.

reliabilityguy2 replies#
What was the objection to namespaces?
degaart2 replies#
Try to follow the WinUI 3 tutorials. You'll understand.
pjc50#
Could you elaborate please?

WinUI3 is awful for unrelated reasons. It's even a pain to use from C#, which is the language it (and the WinRT APIs) were designed to be the primary use case with. And of course C# namespaces work fine.
Newer Windows APIs are annoying to work with from C++, which is Microsoft's fault but signals something about direction.

reliabilityguy#
I’m sorry, but this is very lazy non-answer.

If you have specific pitfalls to share, do so, otherwise what’s the point of commenting?

chris_j1 reply#
My (distant) recollection is that certain compilers didn't support them well at the time. We had to use the IBM C compiler for AIX back then, and it could have been that one.
reliabilityguy#
Ah, interesting.

At the time of c++11 I did not write c++ at all, so I’m not familiar with the growing pains of namespaces. It makes sense.
Today, I find it quite nice and elegant.