-
Notifications
You must be signed in to change notification settings - Fork 883
v2_0_cpp_versioning
msgpack-c have introduced API versioning mechanism.
MSGPACK_DEFAULT_API_VERSION means the default version of msgpack-c API. The current value is 2.
#if !defined(MSGPACK_DEFAULT_API_VERSION)
#define MSGPACK_DEFAULT_API_VERSION 2
#endif
When you want to set MSGPACK_API_VERSION explicitly, give the macro value as follows:
g++ -DMSGPACK_API_VERSION=1
If you set MSGPACK_API_VERSION to 1, the API is compatible to version 1.4.x.
MSGPACK_DEFAULT_API_NS is a namespace name of the default msgpack version. It names 'v' + MSGPACK_DEFAULT_API_VERSION. e.g.) v1, v2, ...
It is used when you declare and define your custom overloads of operators.
See the following example:
https://github.com/msgpack/msgpack-c/blob/cpp_master/example/cpp03/class_non_intrusive.cpp#L47
MSGPACK_API_VERSION_NAMESPACE is a function style macro. It defines a namespace. You can pass an argument as the namespace you want to define.
MSGPACK_API_VERSION_NAMESPACE(v1) {
// ...
}
MSGPACK_API_VERSION_NAMESPACE(v2) {
// ...
}
The macro is expanded to namespace. If the given namespace name is same as MSGPACK_DEFAULT_API_NS, the macro is expanded as follows:
In the case MSGPACK_DEFAULT_API_NS == v2
C++11
namespace v1 {
// ...
}
inline namespace v2 {
// ...
}
C++03
namespace v1 {
// ...
}
namespace v2{}; using namespace v2; namespace v2 {
// ...
}
If compiler setting is C++/CLI, then MSGPACK_NULLPTR is defined as __nullptr, otherwise nullptr. msgpack-c supports standard C++, C++/CLI is not a standard C++, but we support is as much as we can do. When you write a pull request, plase use MSGPACK_NULLPTR as null pointer.
-
Home
- Q&A
- v2.0.x or later
- v1.1.x - v1.4.x
- v1.0.x