Boost logo

Boost :

From: Andy Sawyer (boost_at_[hidden])
Date: 2000-07-26 13:28:01


On 21 July 2000 19:58, Valentin Bonnard wrote:

> > I haven't seen any instructions yet, that 'undefined'
> operations shall throw
> > exceptions.
>
> In MSVC it's what happens. (Not C++ exceptions, but some kind
> of OS-specific C++-independant exceptions.)
>
> The interaction in MSVC (or in an ideal world) with C++ ES
> (exception specs) isn't very clear to me.
>

 Actually what happens is that the OS "throws an exception"
(i.e. generates a fault). The OS allows the developer to write
a "fault handler", and the default handler in the MS RunTime
translates the OS exception into a C++ exception (you can, of
course, change this behaviour)
 So neither the original OS exception nor the C++ exception
are actually compiler generated in this circumstance.

> > Couldn't there be an option to detect them? Like:
> >
> > T& operator *() const throw()
> > {
> > #if BOOST_DETECT_UNDEFINED_OPS
> > if (v==NULL) throw undefined_behaviour();
> > #endif
> > return *v;
> > }
>

 You could, if you so desired, do exactly that by supplying
your own exception translator.

Regards,
 Andy

-- 
Andy Sawyer, Technical Director, Sufficiently Advanced Technology Ltd.
mailto:andys_at_[hidden]        ICQ:14417938        http://www.morebhp.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk