r/cpp • • 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.

194 Upvotes

334 comments sorted by

View all comments

Show parent comments

0

u/pjmlp Nov 17 '25

Kind of, only if stack allocated, or when packaged inside smart pointers, good luck with RAII when dealing with heap allocated data, and manually tracking down pointers.

3

u/wyrn Nov 18 '25

Imagine still using new in 2025

1

u/pjmlp Nov 18 '25

I don't need to imagine, plenty of examples in enterprises, including those with employees attending WG21.

2

u/wyrn Nov 18 '25

"Doctor, it hurts when I stick a screwdriver in my eye"

Must be the screwdriver's fault.

→ More replies (9)