In my class I was using such field:
private:
bool firstSeqNumReceived;
Everything were working fine for a while but after one commit I've figured out that now field is true
by default. Surprisingly field is not initialized to false
by default, instead assigned value is implementation dependent (refer to What is the default value for C++ class members for more details )
Now I wonder why compiler doesn't produce compile-time error forcing me to add initialization? Who needs "implementation-dependent" default value, are there any use-cases? Why not produce compile-time error in this case?