2 ms·
You still haven't responded to his point, which is that to deal with the reality that constructors and destructors can fail, he ended up having to write more co
by gruseom 15y ago
You still haven't responded to his point, which is that to deal with the reality that constructors and destructors can fail, he ended up having to write more complex code than he would in C. (Specifically, the code in the passage I cited, which turns each object into a little state machine.) Saying "just make those things not fail" is no answer at all. So, to repeat: how could he meet his error-handling goals in C++ without handling object construction/destruction in that state machine style?
I have no opinion about this, but given that it's the point of the article, that's what people should be addressing.
- pestaa 15y agoIt's not that constructors/destructors can fail, it's about the conscious decision when you make them to. If you choose not to use exceptions at all, you can prevent improper state before object construction, just like you would in C's init_foobar().