BSON_VERSION(3)
BSON_VERSION(3) β Versioning Macros and Functions β¨
okay bestie, welcome to the libbson manual page for BSON_VERSION(3) β it's literally all about versioning macros and functions, and it's giving βlet me check what version Iβm compiling againstβ main character energy. π
π MACROS π
so the following preprocessor macros are here to do various checks based on the version of the library youβre compiling against. lowkey iconic when you only want to enable a feature on a certain version of the library β no cap, thatβs exactly the use case. π
β¨ SYNOPSIS β¨
hereβs the whole synopsis, verbatim bestie:
#define BSON_CHECK_VERSION(major, minor, micro)
#define BSON_MAJOR_VERSION (1)
#define BSON_MINOR_VERSION (4)
#define BSON_MICRO_VERSION (1)
#define BSON_VERSION_S "1.4.1"
#define BSON_VERSION_HEX \
(BSON_MAJOR_VERSION << 24 | BSON_MINOR_VERSION << 16 | \
BSON_MICRO_VERSION << 8)
and if you wanna only compile a block on Libbson 1.1.0 and newer, you do it like this:
#if BSON_CHECK_VERSION(1, 1, 0)
static void
do_something (void)
{
}
#endif
thatβs the vibe: BSON_CHECK_VERSION(major, minor, micro) is the check, and the numeric macros are BSON_MAJOR_VERSION (1), BSON_MINOR_VERSION (4), BSON_MICRO_VERSION (1), plus BSON_VERSION_S ("1.4.1") and BSON_VERSION_HEX doing its little shift-and-or thing. π¦
π AUTHOR π
MongoDB, Inc β periodt. π
π COPYRIGHT π
2009-present, MongoDB, Inc. β protecting the legacy, fr fr. πΈ
mwah π this cute lil page was brought to you by libbson version 2.5.6, dated Oct 09, 2026, and the BSON_VERSION(3) manual page itself. xoxo π
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms