1#ifndef CPP_H 2#define CPP_H 3/* cpp - C++ in the kernel 4** 5** Initial version by Axel D��rfler, axeld@pinc-software.de 6** This file may be used under the terms of the MIT License. 7*/ 8 9#ifdef __cplusplus 10 11#include <new> 12#include <stdlib.h> 13 14using namespace std; 15 16// Oh no! C++ in the kernel! Are you nuts? 17// 18// - no exceptions 19// - (almost) no virtuals (well, the Query code now uses them) 20// - it's basically only the C++ syntax, and type checking 21// - since one tend to encapsulate everything in classes, it has a slightly 22// higher memory overhead 23// - nicer code 24// - easier to maintain 25 26 27inline void *operator new(size_t size, const nothrow_t&) throw() 28{ 29 return malloc(size); 30} 31 32inline void *operator new[](size_t size, const nothrow_t&) throw() 33{ 34 return malloc(size); 35} 36 37inline void operator delete(void *ptr) 38{ 39 free(ptr); 40} 41 42inline void operator delete[](void *ptr) 43{ 44 free(ptr); 45} 46 47// now we're using virtuals 48extern "C" void __pure_virtual(); 49 50//extern nothrow_t _dontthrow; 51//#define new new (_dontthrow) 52 53#endif // __cplusplus 54 55#endif /* CPP_H */ 56