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 and exception


Tim Hollebeek wrote:
> Yes ... the biggest thing you're leaving out is the fact that for a
> decade, new() did return null, and these are precisely the sorts of
> programs that are being compiled without exceptions.
> 
> So the null checks don't necessarily have to be added; they may
> already be there.

In certain high-performance programs, I use -fno-exceptions (for better
optimisation; I know there are no exceptions), and I do _not_ use the
nothrow version of new() precisely because I know that new() will never
return NULL, and I don't want the constructors to check for this.
(If the program really does run out of memory, it is terminated the hard
way as with xmalloc()).

For this reason, I don't declare new() as throw() -- because GCC will
then check for NULL, which I'd rather it did not.

So, please don't make it so I cannot disable NULL checks and disable
exceptions at the same time.

Thanks :)
-- Jamie


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