
Jeff Garland wrote:
On Wed, 21 Jul 2004 21:00:00 +0300, Peter Dimov wrote
The real question is: do the benefits (none from my POV) gained by _not_ supplying a default constructor outweigh the disadvantages?
How about clearer code:
//what does it do -- non-obvious date d; std::cout << d << std::endl;
//obvious... date d(not_a_date_time); std::cout << d << std::endl;
Personally, that's enough for me...
That's why I said "from my POV". Obviously you can still write the // obvious way. Having a default constructor simply does not _prevent_ the "non-obvious" code from being written. "From my POV", I see little value in these "prevention" features, because I never obfuscate code just because it's allowed. I do know that other viewpoints exist. It's a philosophical issue and the spirit of C++ is to give programmers the benefit of the doubt (i.e. not penalize the "I know what I'm doing" group).