logoalt Hacker News

ninkendo • today at 6:02 PM • 0 replies • view on HN

> It is up to the constructor to only initialize storage, or do whatever it feels like to have values assigned to it.

Right, see the "I guess the argument might be" part above... I find this to be a very questionable design choice, leaving you to have to go and read a header somewhere to determine whether `Foo f;` is safe or not. But it's not really a choice, is it? C++ had to do it this way to be compatible with how C programs were written back in the 1970s.

> By the way, already in the 16 bit days you could configure to have warnings as errors for variables being used without initialisation.

Ah yes, the "but C can be configured to be not-insane" argument, one of my favorite pjmlp-isms, right up there with "but $LANG's compiler is written in C++" and "but you already get memory safety with a GC". Keep on doing you!