r/cpp • u/Tcshaw91 • Nov 16 '25
Wait c++ is kinda based?
Started on c#, hated the garbage collector, wanted more control. Moved to C. Simple, fun, couple of pain points. Eventually decided to try c++ cuz d3d12.
-enum classes : typesafe enums -classes : give nice "object.action()" syntax -easy function chaining -std::cout with the "<<" operator is a nice syntax -Templates are like typesafe macros for generics -constexpr for typed constants and comptime function results. -default struct values -still full control over memory -can just write C in C++
I don't understand why c++ gets so much hate? Is it just because more people use it thus more people use it poorly? Like I can literally just write C if I want but I have all these extra little helpers when I want to use them. It's kinda nice tbh.
View all comments
Show parent comment
2
u/FlyingRhenquest Nov 16 '25
Oh no, that's definitely C++. The problem is the compiler can try to match your function against a very large number of potential template instances that you might not even be aware exist, and the compiler will list out every template instance it attempted to match against. You can easily go through hundreds of lines of errors from templates in the standard template library before you even find the one line in your code that's causing the problem. And something as silly as missing a const somewhere in your code can lead to that wall of compiler errors.
A lot of newer libraries will include concepts that they can static assert on to tell you exactly where the problem was, but the library programmer has to put some effort into setting up those error messages and a lot of libraries (and the standard template library) don't.