-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Description
Please add version numbers in header files, that can be used at compile time.
For example:
#define RYML_VERSION "0.7.0"
#define RYML_VERSION_MAJOR 0
#define RYML_VERSION_MINOR 7
#define RYML_VERSION_PATCH 0
This helps when code using ryml needs to be different for v0.6.0 and v0.7.0, due to api breaking changes.
To illustrate, right now my application code looks like:
ryml::ParserOptions opts;
opts.locations(true);
#if OTEL_HAVE_RYML == 6
ryml::Parser parser(opts);
#endif
#if OTEL_HAVE_RYML == 7
ryml::Parser::handler_type event_handler;
ryml::Parser parser(&event_handler, opts);
#endif
ryml::Tree tree;
ryml::csubstr filename;
ryml::csubstr csubstr_content;
std::unique_ptr<Document> doc;
filename = ryml::to_csubstr(source);
csubstr_content = ryml::to_csubstr(content);
try
{
#if OTEL_HAVE_RYML == 6
tree = parser.parse_in_arena(filename, csubstr_content);
#endif
#if OTEL_HAVE_RYML == 7
tree = parse_in_arena(&parser, filename, csubstr_content);
#endif
tree.resolve();
}
catch (...)
where OTEL_HAVE_RYML
is evaluated by CMake, based on what find_package() actually found.
It is desirable to rely on RYML_VERSION_MAJOR
, RYML_VERSION_MINOR
and RYML_VERSION_PATCH
found in the ryml header files instead.
Metadata
Metadata
Assignees
Labels
No labels