Skip to content

v1_0_cpp_configure

Takatoshi Kondo edited this page Apr 3, 2015 · 2 revisions

configuration

MSGPACK_USE_LEGACY_NAME_AS_FLOAT

Default value: not defined

According to the msgpack format, that supports IEE 754 single or double precision floating-point number: https://github.com/msgpack/msgpack/blob/master/spec.md#float-format-family

msgpack-c provides the API to access to the float format family. When you use msgpack::object, 'type' data member is 'msgpack::type::FLOAT' in C++ and 'MSGPACK_OBJECT_FLOAT' in C. The union field name is 'f64'. But it used to have different names.

old name new name
msgpack::type::DOUBLE msgpack::type::FLOAT
MSGPACK_OBJECT_DOUBLE MSGPACK_OBJECT_FLOAT
dec f64

When you define the macro MSGPACK_USE_LEGACY_NAME_AS_FLOAT, both the old name and the new name are available. Otherwise only the new name is available.

See the following commit: https://github.com/msgpack/msgpack-c/commit/737e6703df2cad06cfb16e3e0e34a02ec5212c38

MSGPACK_USE_CPP03

Default value: not defined

msgpack is automatically detected C++ version (C++11 or C++03). When you define MSGPACK_USE_CPP03, msgpack use C++03 stuff even if the compiler is C++11.

Use C++03 stuff:

g++ -std=c++03 test.cpp
g++ -std=c++11 -DMSGPACK_USE_CPP03 test.cpp

Use C++11 stuff:

g++ -std=c++11 test.cpp

MSGPACK_EMBED_STACK_SIZE

Default value: 32

When msgpack format byte stream contains composite data, it would contain array of array of ... (N times)

C++

In C, a stack of unpack context is implemented as a std::vector. MSGPACK_EMBED_STACK_SIZE means the hint of the composite level. msgpack reserves MSGPACK_EMBED_STACK_SIZE elements of the std::vector. If the msgpack format byte stream contains over MSGPACK_EMBED_STACK_SIZE elements, std::vector is expanded. You can set the limit of the composite level. See limit size of elements.

C

In C, a stack of unpack context is implemented as an array. MSGPACK_EMBED_STACK_SIZE means the limit of the composite level. If N >= MSGPACK_EMBED_STACK_SIZE unpacking functions return parse error.