|
Boost : |
From: Dave Moore (jdmoore99_at_[hidden])
Date: 2006-02-16 05:38:25
On 2/15/06, Fred Bertsch <fred.bertsch_at_[hidden]> wrote:
>
> > > 4. For embedded environments that cannot use exceptions, I suggest
> using
> > > boost::config to disable the throwing() behavior, and provide an
> > > "isValid/isOpen" accessor function which would allow embedded
> developers to
> > > interrogate the state of the object. When exceptions are turned on,
> this
> > > function would always return true.
> >
> > The only problem I see to this behavior in my experience is that many
> > times you develop a class for an embedded environment without exceptions
> > (because of limitations) and you want to also test it in PC platforms or
> > reuse use that code in another project and environment that do use
> > exceptions. Since the code has not exception support (you don't program
> > with exceptions AND error returns) you want the code to continue working
> > in the new environment when the exceptions are thrown.
> >
> > That's why I would prefer overloading the constructors with an
> > additional std::nothrow parameter for no-exception environments to
> > disable exception and use is_valid() approach instead of defining a
> > macro. This code would still work in new environments when the code is
> > used somewhere else where exceptions are enabled.
> >
> > After the long debate about RAII I don't know if this solution would be
> > accepted by boost members or only compile-time configuration is
> accepted.
This would satisfy my concerns, as it eliminates the 2-phase construction
possibility, and we would simply avoid the nothrow() constructors to guard
against creating 'zombies'
Thanks,
Dave Moore
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk