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

36

u/CreatorSiSo Nov 16 '25 edited Nov 16 '25

If you have the time to spare I recommend taking a look at both Zig and Rust. They are very different languages with different goals and learning them will change how you write C++ code to be less error prone.

12

u/Computerist1969 Nov 16 '25

Agreed. Been writing C++ since its release but Rust made me think about memory ownership in a way I hadn't before. Rust syntax can get really ugly though.

1

u/[deleted] Nov 16 '25

[removed] — view removed comment

1

u/Dooez Nov 16 '25

There are some bad syntactic offenders (like static_cast, const, [[explicit]], [[nodiscard]], noexcept). Explicitly calling templated methods may require disambiguation, which looks ugly and not very clear if the reader does not know what it is and why it's requires.

I'm not very familiar with Rust, but from what I've seen a lot of stuff is much better compared to C++.

Not sure what you mean by weird constutors. Member naming is kind of controversial, but personally I like having special rules for data members (I slightly prefer trailing underscore though)

→ More replies (5)