[C++] __builtin_new vs operator new
Jason Merrill
jason@cygnus.com
Mon Apr 24 20:27:00 GMT 2000
>>>>> Benjamin Kosnik <bkoz@cygnus.com> writes:
> Check this out:
> void test03()
> {
> using namespace std;
> bool test = false;
> (void) set_new_handler(NULL);
> try {
> void* p = operator new(INT_MAX);
> }
> catch (bad_alloc& ba) {
> test = true;
> }
> }
> This does not exhibit standard-conformant behavior. I would expect
> that operator new would be called, that attempts to allocate this
> ammount of memory will fail, and as set_new_handler is set to NULL,
> operator new would return std::bad_alloc.
Works for me.
> This does not happen. In particular, operator new (from
> gcc/cp/new1.cc), which looks correct, does not get called.
> call __builtin_new <--------------here
Um, and just what do you think __builtin_new *is*?
Jason
More information about the Gcc-bugs
mailing list