/usr/include/singular/omalloc/omallocClass.h is in libsingular4-dev-common 4.0.3+ds-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #ifndef OMALLOCCLASS_H
#define OMALLOCCLASS_H
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT: standard version of C++-memory management alloc func
*/
#ifdef __cplusplus
#include <new>
#include <stdlib.h>
#include <omalloc/omalloc.h>
class omallocClass
{
public:
/* We define those, so that our values of
OM_TRACK and OM_CHECK are used */
void* operator new ( size_t size )
#ifndef __GNUC__
throw (std::bad_alloc)
#endif
{
void* addr;
omTypeAlloc(void*, addr, size);
return addr;
}
void operator delete ( void* block )
#ifndef __GNUC__
throw ()
#endif
{
omFree( block );
}
void* operator new[] ( size_t size )
#ifndef __GNUC__
throw (std::bad_alloc)
#endif
;
void operator delete[] ( void* block )
#ifndef __GNUC__
throw ()
#endif
;
// The C++ standard has ratified a change to the new operator.
//
// T *p = new T;
//
// Previously, if the call to new above failed, a null pointer would've been returned.
// Under the ISO C++ Standard, an exception of type std::bad_alloc is thrown.
// It is possible to suppress this behaviour in favour of the old style
// by using the nothrow version.
//
// T *p = new (std::nothrow) T;
//
// So we have to overload this new also, just to be sure.
//
// A further interesting question is, if you don't have enough resources
// to allocate a request for memory,
// do you expect to have enough to be able to deal with it?
// Most operating systems will have slowed to be unusable
// long before the exception gets thrown.
void * operator new(size_t size, const std::nothrow_t &) throw();
void * operator new[](size_t size, const std::nothrow_t &) throw();
};
#endif
#endif
|