AVRTools
A Library for the AVR ATmega328 and ATmega2560 Microcontrollers
new.h
Go to the documentation of this file.
1 /*
2  new.cpp - operator new implementations not provided with avr-gcc.
3  This is part of the AVRTools library.
4  Copyright (c) 2014 Igor Mikolic-Torreira. All right reserved.
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 
37 #ifndef new_h
38 #define new_h
39 
40 
41 #include <stdlib.h>
42 
43 void* operator new( size_t size );
44 void* operator new[]( size_t size );
45 
46 
47 void operator delete( void* ptr );
48 void operator delete[]( void* ptr );
49 
50 #if __cplusplus >= 201402L
51 
52 void operator delete ( void* ptr, size_t sz );
53 void operator delete[]( void* ptr, size_t sz );
54 
55 #endif
56 
57 
58 // Placement new & delete operators
59 
60 inline void* operator new( size_t, void* ptr )
61 { return ptr; }
62 inline void* operator new[]( size_t, void* ptr )
63 { return ptr; }
64 
65 inline void operator delete( void* , void* )
66 { }
67 inline void operator delete[]( void* , void* )
68 { }
69 
70 
71 #endif
72