Frobby  0.9.0
stdinc.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
24 #ifdef _MSC_VER // For Microsoft Compiler in Visual Studio C++.
25 #define _SCL_SECURE_NO_WARNINGS
26 #pragma warning (push, 1) // Reduce warning level for GMP headers.
27 #endif
28 
29 // Some versions of GMP do not define gmp_fprintf unless cstdio is
30 // included first, so we have to include it here.
31 #include <cstdio>
32 
33 #include <gmp.h>
34 #include <gmpxx.h>
35 
36 #ifdef _MSC_VER // For Microsoft Compiler in Visual Studio C++.
37 #pragma warning (pop) // Go back to previous warning level.
38 #pragma warning (disable: 4996) // std::copy is flagged as dangerous.
39 #pragma warning (disable: 4290) // VC++ ignores throw () specification.
40 #pragma warning (disable: 4127) // Warns about using "while (true)".
41 #pragma warning (disable: 4100) // Warns about unused parameters.
42 #pragma warning (disable: 4800) // Warns on int to bool conversion.
43 #pragma warning (disable: 4146) // Warns on unary minus on unsigned (bit trick)
44 
45 // This warning warns about using the this pointer in base member
46 // initializer lists. This is a pretty good warning as that can
47 // obviously easily go wrong, but it is pretty useful to do as well,
48 // so the warning is turned off.
49 #pragma warning (disable: 4355)
50 
51 #ifdef _DEBUG
52 #ifndef DEBUG
53 #define DEBUG
54 #endif
55 #endif
56 
57 #ifdef DEBUG
58 // MSC's map header has an issue where you get a syntax error if you
59 // define a macro for new like we do below. We work around this by including
60 // map before we define the macro.
61 #include <map>
62 #endif
63 #endif
64 
65 #include <cstddef>
66 #include <memory>
67 using namespace std;
68 
69 #ifdef DEBUG
70 #include <iostream> // Useful for debugging.
71 #define PRINT
72 #define IF_DEBUG(X) X
73 #include <cassert>
74 #define ASSERT(X) assert(X);
75 void* operator new(size_t s, const char* file, size_t line)
76  throw (std::bad_alloc);
77 void* operator new[](size_t s, const char* file, size_t line)
78  throw (std::bad_alloc);
79 void operator delete(void* s, const char* file, size_t line);
80 void operator delete[](void* s, const char* file, size_t line);
81 #define NEW_MACRO new (__FILE__, __LINE__)
82 #define new NEW_MACRO
83 #else
84 #define IF_DEBUG(X)
85 #define ASSERT(X)
86 #endif
87 
88 typedef unsigned int Exponent;
89 
92 typedef unsigned long Word;
93 static const size_t BitsPerWord = 8 * sizeof(Word);
94 
98 static const size_t MemoryAlignment = sizeof(long);
99 
101 namespace constants {
102  extern const char* const version;
103 }
MemoryAlignment
static const size_t MemoryAlignment
The alignment that memory allocators must ensure.
Definition: stdinc.h:98
BitsPerWord
static const size_t BitsPerWord
Definition: stdinc.h:93
Exponent
unsigned int Exponent
Definition: stdinc.h:88
Word
unsigned long Word
The native unsigned type for the CPU.
Definition: stdinc.h:92
std
Definition: HilbertSlice.h:62
constants
Definition: stdinc.cpp:19
constants::version
const char *const version
Definition: stdinc.cpp:20