
David Abrahams <dave@boost-consulting.com> writes:
Ion GaztaƱaga <igaztanaga@gmail.com> writes:
Ok. I think I can provide both approaches so that who doesn't want (or can't because of a restricted embedded enviroment) use exceptions can have its alternative.
< C R I N G E >
If you really *must* provide 2-phase construction, then please make it a special mode that can be enabled with an #ifdef.
I see you have strong opinions like me. So, no ifdefs, please.
Then consider making the class with 2-phase initialization a different type.
Or consider providing a function that tests whether initialization was successful and is guaranteed to always return true unless exceptions are disabled. I'm sure given time we could think of even more ways to address this without providing a default ctor. The point is that the guarantees made to those who use a C++ compiler shouldn't be weakened just in order to accomodate people who want to disable standard C++ features. -- Dave Abrahams Boost Consulting www.boost-consulting.com