Reputation: 30645
I am using Visual Studio 2012 with the Intel C/C++ compiler and when stepping in to a line like:
x = new X();
I then see code which looks like:
#ifdef _SYSCRT
#include <cruntime.h>
#include <crtdbg.h>
#include <malloc.h>
#include <new.h>
#include <stdlib.h>
#include <winheap.h>
#include <rtcsup.h>
#include <internal.h>
void * operator new( size_t cb )
{
void *res;
for (;;) {
// allocate memory block
res = _heap_alloc(cb);
// if successful allocation, return pointer to memory
if (res)
break;
// call installed new handler
if (!_callnewh(cb))
break;
// new handler was successful -- try to allocate again
}
RTCCALLBACK(_RTC_Allocate_hook, (res, cb, 0));
return res;
}
#else /* _SYSCRT */
#include <cstdlib>
#include <new>
_C_LIB_DECL
int __cdecl _callnewh(size_t size) _THROW1(_STD bad_alloc);
_END_C_LIB_DECL
void *__CRTDECL operator new(size_t size) _THROW1(_STD bad_alloc)
{ // try to allocate size bytes
void *p;
while ((p = malloc(size)) == 0)
if (_callnewh(size) == 0)
{ // report no memory
_THROW_NCEE(_XSTD bad_alloc, );
}
return (p);
}
#endif /* _SYSCRT */
is this the definition of new() as per the Intel compiler? As in I can see how Intel implement the C++ standard whilst debugging through my app?
How could I see what is in malloc.c (as opposed to malloc.h)?
EDIT: I think this is Microsoft new() because Microsoft appears in the comments. Why am I seeing Microsoft implementation of new() when I am using the Intel compiler?
Upvotes: 0
Views: 419
Reputation: 1399
Upvotes: 0