On Thu, Aug 22, 2013 at 7:23 AM, Jakub Jelinek <ja...@redhat.com> wrote: > On Thu, Aug 22, 2013 at 02:19:39PM +0200, Richard Biener wrote: >> Gabriel Dos Reis <g...@integrable-solutions.net> wrote: >> >Now that we have transitioned to C++, do we still need to use >> >placebo like XNEW and XNEWVEC in GCC source code proper? >> >(I am not talking about uses in liberty.) >> > >> >Note that XNEW in particular does not work for types with >> >non-default constructors. >> > >> >We introduced these macros so that they take care of casts >> >that were required for going from void* to T*. A new-expression >> >automatically gives a typed pointer. >> >> I believe we also use them to dispatch to xmalloc for hosts that cannot >> use malloc. Another issue that is gone for good with C++ - at least if >> you use 'new'. Existing uses already are there, so just go ahead. >> Support for constructing and destructing GC objects will be another story >> of course. > > Do we install new_handler though so that if memory allocation fails it > shows the desired message and exits with the right code, rather than > just aborting?
Excellent suggestion. I don't promise to implement it right away but though (I have my hands full of something else) -- Gaby