1 // Created on: 2012-01-19
2 // Created by: Dmitry BOBYLEV
3 // Copyright (c) 2012-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and / or modify it
8 // under the terms of the GNU Lesser General Public version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Standard_DefineAlloc_HeaderFile
17 # define _Standard_DefineAlloc_HeaderFile
19 // Macro to override new and delete operators for arrays.
20 // Defined to empty for old SUN compiler
21 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
22 # define DEFINE_STANDARD_ALLOC_ARRAY
24 # define DEFINE_STANDARD_ALLOC_ARRAY \
25 void* operator new[] (size_t theSize) \
27 return Standard::Allocate (theSize); \
29 void operator delete[] (void* theAddress) \
31 Standard::Free (theAddress); \
35 // Macro to override placement new and placement delete operators.
36 // For Borland C and old SUN compilers do not define placement delete
37 // as it is not supported.
38 # if defined(__BORLANDC__) || (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
39 # define DEFINE_STANDARD_ALLOC_PLACEMENT \
40 void* operator new (size_t, void* theAddress) \
45 # define DEFINE_STANDARD_ALLOC_PLACEMENT \
46 void* operator new (size_t, void* theAddress) \
50 void operator delete (void*, void*) \
55 // Macro to override operators new and delete to use OCC memory manager
56 # define DEFINE_STANDARD_ALLOC \
57 void* operator new (size_t theSize) \
59 return Standard::Allocate (theSize); \
61 void operator delete (void* theAddress) \
63 Standard::Free (theAddress); \
65 DEFINE_STANDARD_ALLOC_ARRAY \
66 DEFINE_STANDARD_ALLOC_PLACEMENT
68 // Declare operator new in global scope for old sun compiler
69 #ifndef WORKAROUND_SUNPRO_NEW_PLACEMENT
70 #define WORKAROUND_SUNPRO_NEW_PLACEMENT
71 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x420)
72 inline void* operator new(size_t,void* anAddress)