Gromacs  2018.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs
basedefinitions.h File Reference
#include <stdint.h>
#include <inttypes.h>
+ Include dependency graph for basedefinitions.h:
+ This graph shows which files directly or indirectly include this file:


Basic types and macros used throughout GROMACS.

Fixed-width integer types

These types and macros provide the equivalent of 32- and 64-bit integer types from C99 headers stdint.h and inttypes.h. These headers are also there in C++11. The types and macros from here should be used instead of int32_t etc.

(MSVC 2015 still doesn't support the format strings.)

#define GMX_PRId32   PRId32
#define GMX_SCNd32   SCNd32
#define GMX_PRId64   PRId64
#define GMX_SCNd64   SCNd64
#define GMX_PRIu32   PRIu32
#define GMX_SCNu32   SCNu32
#define GMX_PRIu64   PRIu64
#define GMX_SCNu64   SCNu64
#define GMX_INT32_MAX   INT32_MAX
#define GMX_INT32_MIN   INT32_MIN
#define GMX_INT64_MAX   INT64_MAX
#define GMX_INT64_MIN   INT64_MIN
#define GMX_UINT32_MAX   UINT32_MAX
#define GMX_UINT32_MIN   UINT32_MIN
#define GMX_UINT64_MAX   UINT64_MAX
#define GMX_UINT64_MIN   UINT64_MIN
typedef int32_t gmx_int32_t
typedef int64_t gmx_int64_t
typedef uint32_t gmx_uint32_t
typedef uint64_t gmx_uint64_t


#define FALSE   0
 False value for gmx_bool. More...
#define TRUE   1
 True value for gmx_bool. More...
#define BOOL_NR   2
 Number of gmx_bool values. More...
#define gmx_inline   inline
 Keyword to use in C code instead of C99 inline. More...
#define gmx_restrict   __restrict
 Keyword to use in instead of C99 restrict. More...
 Defined to 1 when compiling as C++11. More...
#define gmx_unused
 Attribute to suppress compiler warnings about unused function parameters. More...
#define __has_feature(x)   0
 For compatibility with non-clang compilers. More...
#define gmx_noreturn
 Indicate that a function is not expected to return.
#define GMX_UNUSED_VALUE(value)   (void)value
 Macro to explicitly ignore an unused value.
#define GMX_IGNORE_RETURN_VALUE(call)   ::gmx::internal::ignoreValueHelper(call)
 Macro to explicitly ignore a return value of a call. More...


typedef int gmx_bool
 Boolean type for use in GROMACS C code. More...

Macro Definition Documentation

#define __has_feature (   x)    0

For compatibility with non-clang compilers.

#define BOOL_NR   2

Number of gmx_bool values.

#define FALSE   0

False value for gmx_bool.


Defined to 1 when compiling as C++11.

While GROMACS only supports C++11 compilation, there are some parts of the code that are compiled with other tools than the actual C++ compiler, and these may not support C++11. Most notable such case is all of CUDA code (with CUDA versions older than 6.5), but other types of kernels might also have similar limitations in the future.

The define is intended for conditional compilation in low-level headers that need to support inclusion from such non-C++11 files, but get significant benefit (e.g., for correctness checking or more convenient use) from C++11. It should only be used for features that do not influence the ABI of the header; e.g., static_asserts or additional helper methods.

#define gmx_inline   inline

Keyword to use in C code instead of C99 inline.

Some of the C compilers we support do not recognize the C99 keyword inline. This macro should be used in C code and in shared C/C++ headers to indicate a function is inlined. C++ code should use plain inline, as that is already in C++98.

#define gmx_restrict   __restrict

Keyword to use in instead of C99 restrict.

We cannot use restrict because it is only in C99, but not in C++. This macro should instead be used to allow easily supporting different compilers.

#define gmx_unused

Attribute to suppress compiler warnings about unused function parameters.

This attribute suppresses compiler warnings about unused function arguments by marking them as possibly unused. Some arguments are unused but have to be retained to preserve a function signature that must match that of another function. Some arguments are only used in some conditional compilation code paths (e.g. MPI).

#define TRUE   1

True value for gmx_bool.

Typedef Documentation

typedef int gmx_bool

Boolean type for use in GROMACS C code.

There is no standard size for 'bool' in C++, so when we previously defined it to int for C code the data types (and structs) would have different size depending on your compiler, both at GROMACS build time and when you use the library. The only way around this is to NOT assume anything about the C++ type, so we cannot use the name 'bool' in our C code anymore.