TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 230 subscribers
Post #25016 14
I am new to C++, is it just me or is the checklist kinda crazy? How often do you encounter these or plan on making use of them like the newer C++26 features like contracts? Looking for more experienced dev opinions...

I know Python and have been binging C++ for a couple of days now from scratch. C++ feels like a language where you gradually discover a huge checklist of "STATE YOUR INTENT" due to years of probably layering on things to shore up its weaknesses of memory/type safety etc. Like I get it, it's how C++ was designed for things to be explicit and it's like the English language where you don't need to know every word and in this case, feature, but every line of code makes me feel I'm asking a gajillion questions.

So far I have jotted down some stuff that took me awhile to digest...

* const
* constexpr
* [[nodiscard]]
* std::expected
* delete("reason")
* smart pointers
* zero-initialization curly brackets
* structured bindings
* assert
* static assert
* contracts

So I guess I'm not very familiar with the ecosystem or ever worked with other C++ code. Like is this good or bad? I would think it's very safe but do and should people code actually C++ like this? I don't have a frame of reference to relate to and I don't know if the C++ community is going to jump on things like C++26's contracts or reject it. What's the current attitude? If you were a teammate, would you love or hate to see something like this?

[[nodiscard]] constexpr std::expected<int, Error> GetHP(const std::unique_ptr<Player>& player)
{
assert(player);
if (!player) return std::unexpected(Error::NullPlayer);
const auto [hp, alive] = std::pair{player->hp, player->hp > 0};
static_assert(sizeof(int) == 4);
return alive ? hp : 0;
}

https://redd.it/1sqhobx
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Oct 6, 2026==2896379== logger no timeout configured, using default 1000 ms ==2896379== ==2896379== HE…
  2. Oct 6, 2026No, -Wall -Werror Does Not Guarantee Detection of Conditionally Uninitialized Local Variab…
  3. Oct 6, 2026C++20 modules support: 228 projects already available to be consumed Hello everyone. I che…
  4. Oct 6, 2026operator<>: A Dream of Higher-order Metaprogramming Parity https://www.elbeno.com/blog/?p=…
  5. Oct 6, 2026University of Waterloo user study on understanding CMake changes Hi everyone, I’m Mattie N…
  6. Oct 6, 2026Try to Implement Reflection Annotations in C++20 https://typecombinator.github.io/en/posts…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →