1 // File: Standard_DefineAlloc.hxx
2 // Created: Jan 19 10:33:16 2012
3 // Author: Dmitry BOBYLEV
4 // Copyright: Open CASCADE SAS 2012
6 #ifndef _Standard_DefineAlloc_HeaderFile
7 # define _Standard_DefineAlloc_HeaderFile
9 // Macro to override new and delete operators for arrays.
10 // Defined to empty for old SUN compiler
11 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
12 # define DEFINE_STANDARD_ALLOC_ARRAY
14 # define DEFINE_STANDARD_ALLOC_ARRAY \
15 void* operator new[] (size_t theSize) \
17 return Standard::Allocate (theSize); \
19 void operator delete[] (void* theAddress) \
21 Standard::Free (theAddress); \
25 // Macro to override placement new and placement delete operators.
26 // For Borland C and old SUN compilers do not define placement delete
27 // as it is not supported.
28 # if defined(__BORLANDC__) || (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
29 # define DEFINE_STANDARD_ALLOC_PLACEMENT \
30 void* operator new (size_t, void* theAddress) \
35 # define DEFINE_STANDARD_ALLOC_PLACEMENT \
36 void* operator new (size_t, void* theAddress) \
40 void operator delete (void*, void*) \
45 // Macro to override operators new and delete to use OCC memory manager
46 # define DEFINE_STANDARD_ALLOC \
47 void* operator new (size_t theSize) \
49 return Standard::Allocate (theSize); \
51 void operator delete (void* theAddress) \
53 Standard::Free ((Standard_Address&)theAddress); \
55 DEFINE_STANDARD_ALLOC_ARRAY \
56 DEFINE_STANDARD_ALLOC_PLACEMENT
58 // Declare operator new in global scope for old sun compiler
59 #ifndef WORKAROUND_SUNPRO_NEW_PLACEMENT
60 #define WORKAROUND_SUNPRO_NEW_PLACEMENT
61 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x420)
62 inline void* operator new(size_t,void* anAddress)