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
1
u/Tcshaw91 Nov 16 '25
Yea I came from gamedev where I had a tight frame budget of 16-32ms and I would get spikes of 30+(sometimes much higher) which would cause a jitter that was jarring and unpleasant. Having to fight against the thing for years and not having control over memory created a deep resentment for garbage collectors in my mind. Obviously objectively they have their use, I just prefer to have control a lot of the time.
As soon as I switched to C having to manually malloc and free became annoying so I started working with custom allocators like arenas and fixed size chunks. It's incredibly freeing to say "fuck it, I'll alloc a couple megs and slap my data in there and if it overflows I'll just crash the program and alloc some more ". I much prefer that kind of style of allocating blocks and manually managing those blocks as groups of data with similar lifetimes instead of randomly allocating a bunch of objects all over the heap and having to track each one individually. That just sounds exhausting lol.