when I'm doing the following :
T* ptr2 = new (ptr1) T();
I obtain ptr1 == ptr2
When I'm doing :
T* ptr2 = new (ptr1) T[6];
I obtain, under MSVC 2012 in debug, ptr2 > ptr1 (off by 3 bytes)
However the code in the "new" file is :
inline void *__CRTDECL operator new[](size_t, void *_Where) _THROW0()
{ // construct array with placement at _Where
return (_Where);
}
I'm assuming that some debug info are added but I can't make sense of this
The initial ptr1 is obtained through malloc, so I think it's supposed to be aligned to any possible type, so I don't think that alignment is an issue.
Am I doing something that should not be working here ? Why would ptr2 != ptr1 ? Thanks!