CONFIG LIB 1.5
Configuration Files Library (by TGG 2020)
Loading...
Searching...
No Matches
memfun.cpp
1/**********************************************************************/
2/* */
3/* Config files library - (C) TGG 2015 */
4/* */
5/**********************************************************************/
6/* Warsaw 2008 */
7/**********************************************************************/
8/* */
9/* File: memfun.cpp */
10/* */
11/* Written by: F.A.Dul, T.Grabowski */
12/* */
13/* Contents: overloaded "new" operator initializing object with zeros */
14/* */
15/**********************************************************************/
16/* */
17/* */
18
19#include "memfun.h"
20
21using namespace std;
22
23void* MEMFUN::operator new ( size_t st , const char *text, int ierr_print )
24{
25 void *pv = ::operator new( st );
26 if( pv )
27 {
28 memset( pv , 0 , st );
29 if( ierr_print )
30 cerr << "MEMFUN: object " << text
31 << " allocated, address: " << pv
32 << " size=" << st << endl;
33 }
34 else
35 {
36 cout << " MEMFUN: object " << text
37 << " is not allocated !!!" << endl;
38 exit( -1 );
39 }
40
41 return pv;
42}
This file contains some smart functions, operators, macros for safe initializing end erasing the memo...