Hacker News new | ask | show | jobs
by OptionOfT 712 days ago

    T::T() = default;
> You’d expect the printed result to be 0, right? You poor thing. Alas—it will be garbage. Some things can never be perfect, it seems. Here’s a relevant excerpt from our description of value-initialization:

Link: https://consteval.ca/2024/07/03/initialization/#:~:text=You%...

That actually isn't that weird, because it would allow any consumer of your library to change how your library behaves.

1 comments

The alternative not making sense doesn't automatically make this solution make sense :( It just highlights how many corners C++ has backed its design into.