Skip to main content

Open-source C++ Semantic Versioning (SemVer) library

· 2 min read
David Herbert

Softwares and libraries often evolve to include new features, security patches, bug fixes, and refactorings. When software evolves, it may introduce breaking changes (BCs) in its API, breaking the previous contract or compatibility with its clients.

C++ semver announcement cover

Semantic Versioning (SemVer) is a specification for assigning version numbers to software to communicate the degree of change between software releases and updates. However, it turned out the world was missing a proper semantic version library for C++, so we implemented one.

The Backstory

As you may know, all ConfigCat SDKs support standard-compliant semantic version comparison operators. We accept these semantic versions in our targeting rules, making it possible for users to set targeting rules based on these versions and compare them to versions set in our SDKs' user object attributes.

Semantic versions have formal requirements that we enforce in all of our SDKs. To ensure compliance with these requirements in each SDK, we have a common test set that is executed with each SDK. Our JS SDK, for example, includes a test set.

While implementing a new C++ SDK, we needed a C++ SemVer library that fulfilled our requirements by passing this test set. However, we could not find a single C++ library that could do so. We found that each of the already existing libraries did something wrong by breaking one or more requirements of the specification.

We, therefore, agreed that we had to implement a new C++ library that strictly follows the rules of the semantic version specification, and so the open-source C++ SemVer lib was born.

What makes us so proud of this?

  • The C++ SemVer library strictly follows the rules of the semantic version specification.
  • It provides the ability to parse, compare, and increment semantic versions.
  • As an open-source, free-to-use lib, it can also be used by other C++ developers.
  • This makes it easier for C++ developers to release updates on a predictable schedule, which helps avoid conflicts between library updates and other software updates.
  • Using the SemVer lib, you can determine which software version is no longer backward compatible with older versions.
  • We solved a problem for ourselves and other C++ devs as well.

More information on ConfigCat may be found on LinkedIn, Facebook, and Twitter.