This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "new" statement and -fno-exceptions


Mike Stump wrote:

>> (if the "nothrow" variant isn't used) no matter whether
>> -fno-exceptions is used or not. This is somewhat surprising;
>
> Live and learn I guess. Next, I suppose you'll be surprised that when
> you use another C++ library (other than libstdc++) that throws when it
> is documented to throw, even though you compiled your client code with
> -fno-exceptions.
>
> -fno-exceptions doesn't change code you call, only your code that you
> compile. In your case, you call a routine that throws, and it does;
> the solution is to stop calling routines that throw.

I do agree. On the other hand, people don't always know the inners of the
compilers. "new" is part of C++ like "for" or "return", so it is totally
resonable to expect -fno-exceptions to call a non-throwing variant of new. Now
that I think of it, I think it would be a good thing to do. I would also expect
the whole v3 to follow -fno-exceptions (Comeau does it, for instance, for its
standard library). Even most Boost libraries (all of them in principle, but
it's not always tested) have a no exception mode that you can use if you need
to.

Giovanni Bajo



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]