macros.hpp(3) Library Functions Manual macros.hpp(3)

# [NAME](#NAME)

macros.hpp - Preprocessor macros that can customise the cereal library.

# [SYNOPSIS](#SYNOPSIS)

## [Macros](#Macros)

#define **CEREAL\_THREAD\_SAFE** 0  
Whether cereal should be compiled for a threaded environment. #define **CEREAL\_SIZE\_TYPE** uint64\_t  
Determines the data type used for size\_type. #define **CEREAL\_SERIALIZE\_FUNCTION\_NAME** serialize  
The serialization/deserialization function name to search for. #define **CEREAL\_LOAD\_FUNCTION\_NAME** load  
The deserialization (load) function name to search for. #define **CEREAL\_SAVE\_FUNCTION\_NAME** save  
The serialization (save) function name to search for. #define **CEREAL\_LOAD\_MINIMAL\_FUNCTION\_NAME** load\_minimal  
The deserialization (load\_minimal) function name to search for. #define **CEREAL\_SAVE\_MINIMAL\_FUNCTION\_NAME** save\_minimal  
The serialization (save\_minimal) function name to search for. #define **CEREAL\_NOEXCEPT**  
Defines the CEREAL\_NOEXCEPT macro to use instead of noexcept. #define **CEREAL\_ALIGNOF** alignof  
Checks if C++14 is available.

# [Detailed Description](#Detailed_Description)

Preprocessor macros that can customise the cereal library.

By default, cereal looks for serialization functions with very specific names, that is: serialize, load, save, load\_minimal, or save\_minimal.

This file allows an advanced user to change these names to conform to some other style or preference. This is implemented using preprocessor macros.

As a result of this, in internal cereal code you will see macros used for these function names. In user code, you should name the functions like you normally would and not use the macros to improve readability.

# [Macro Definition Documentation](#Macro_Definition_Documentation)

## [#define CEREAL\_ALIGNOF alignof](#_define_CEREAL_ALIGNOF___alignof)

Checks if C++14 is available. Checks if C++17 is available NOTE: clang v5 has a bug with inline variables, so disable C++17 on that compiler Defines the CEREAL\_ALIGNOF macro to use instead of alignof

## [#define CEREAL\_LOAD\_FUNCTION\_NAME load](#_define_CEREAL_LOAD_FUNCTION_NAME___load)

The deserialization (load) function name to search for. You can define CEREAL\_LOAD\_FUNCTION\_NAME to be different assuming you do so before this file is included.

## [#define CEREAL\_LOAD\_MINIMAL\_FUNCTION\_NAME load\_minimal](#_define_CEREAL_LOAD_MINIMAL_FUNCTION_NAME___load_minimal)

The deserialization (load\_minimal) function name to search for. You can define CEREAL\_LOAD\_MINIMAL\_FUNCTION\_NAME to be different assuming you do so before this file is included.

## [#define CEREAL\_NOEXCEPT](#_define_CEREAL_NOEXCEPT)

Defines the CEREAL\_NOEXCEPT macro to use instead of noexcept. If a compiler we support does not support noexcept, this macro will detect this and define CEREAL\_NOEXCEPT as a no-op

## [#define CEREAL\_SAVE\_FUNCTION\_NAME save](#_define_CEREAL_SAVE_FUNCTION_NAME___save)

The serialization (save) function name to search for. You can define CEREAL\_SAVE\_FUNCTION\_NAME to be different assuming you do so before this file is included.

## [#define CEREAL\_SAVE\_MINIMAL\_FUNCTION\_NAME save\_minimal](#_define_CEREAL_SAVE_MINIMAL_FUNCTION_NAME___save_minimal)

The serialization (save\_minimal) function name to search for. You can define CEREAL\_SAVE\_MINIMAL\_FUNCTION\_NAME to be different assuming you do so before this file is included.

## [#define CEREAL\_SERIALIZE\_FUNCTION\_NAME serialize](#_define_CEREAL_SERIALIZE_FUNCTION_NAME___serialize)

The serialization/deserialization function name to search for. You can define CEREAL\_SERIALIZE\_FUNCTION\_NAME to be different assuming you do so before this file is included.

## [#define CEREAL\_SIZE\_TYPE uint64\_t](#_define_CEREAL_SIZE_TYPE___uint64_t)

Determines the data type used for size\_type. cereal uses size\_type to ensure that the serialized size of dynamic containers is compatible across different architectures (e.g. 32 vs 64 bit), which may use different underlying types for std::size\_t.

More information can be found in **cereal/details/helpers.hpp**.

If you choose to modify this type, ensure that you use a fixed size type (e.g. uint32\_t).

## [#define CEREAL\_THREAD\_SAFE 0](#_define_CEREAL_THREAD_SAFE___0)

Whether cereal should be compiled for a threaded environment. This macro causes cereal to use mutexes to control access to global internal state in a thread safe manner.

Note that even with this enabled you must still ensure that archives are accessed by only one thread at a time; it is safe to use multiple archives in parallel, but not to access one archive from many places simultaneously.

# [Author](#Author)

Generated automatically by Doxygen for cereal from the source code.

Mon Oct 26 2026 20:39:03 cereal

---

Document: macros.hpp(3) from cereal 1.3.2-r8 (Chainguard OS)
Source: https://github.com/USCiLab/cereal
