On May 6, 10:43 am, Johan Torp <johan.t...@[EMAIL PROTECTED]
> wrote:
> IIRC, the standard library avoids throwing exceptions so that users
> which compile without exception sup****t shall be able to use as much
> of the standard library as possible. Is this correct, incorrect or are
> there other motivations?
>
> Will this also be the case for the newly accepted libraries and for
> TR2?
>
> Will this "undefined behaviour"-strategy only apply to broken pre-
> conditions or will error codes and the like be used for re****ting
> internal errors?
>
> Best Regards, Johan
Mostly, the standard library avoids throwing exceptions --or error
checking in general--for performance reasons. This is true of the
standard C library as well. The fact that standard C++ uses exceptions
has little to do with it.
Many good implementations of standard libraries have a checked mode,
that will assert or throw or whatever based on invalid input, but the
idea is to turn this off for production releases. The MSVC native
library by default always has "secure" mode turned on, which does a
LOT of checking, more than you could ever imagine. However, this is so
egregiously slow that many developers spend a lot of time trying to
figure out how to turn it off. (_SECURE_SCL=0 or somethign like that)
TR2 follows the same guidelines as the std:: stuff, in that errors are
re****ted by exception, unless they are the really stupid kind (like
passing null pointers around, or getting iterator backward), then you
get undefined behaviour.
The good news is that much of the standard is being retrofitted with
concepts, to help you avoid these really stupid error (and more subtle
ones) at compile time, instead of waiting for a core dump.
Lance
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|