BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslscm_versiontag

Macros

#define BSL_VERSION_MAJOR   4
 Provide the major version number of the current (latest) BSL release.
 
#define BSL_VERSION_MINOR   14
 Provide the minor version number of the current (latest) BSL release.
 
#define BSL_MAKE_VERSION(major, minor)
 
#define BSL_GET_VERSION_MAJOR(version)   ((version / 1000000) % 100)
 
#define BSL_GET_VERSION_MINOR(version)   ((version / 100) % 10000)
 
#define BSL_VERSION
 

Detailed Description

Outline

Purpose

Provide versioning information for the bsl package group.

Classes

Macros

See also
bslscm_version

Description

This component provides versioning information for the bsl package group. The BSL_VERSION and BSL_MAKE_VERSION macros that are supplied can be used for conditional-compilation based on bsl version information.

Note that the exact format of the values BSL_MAKE_VERSION outputs is deliberately unspecified - it is subject to change without notice. The only valid operations on the output of BSL_MAKE_VERSION are comparing it with the result of other BSL_MAKE_VERSION invocations, or using BSL_GET_VERSION_MAJOR or BSL_GET_VERSION_MINOR to extract the major/minor components respectively.

The following usage example illustrates this basic capability.

Usage

At compile time, the version of BSL can be used to select an older or newer way to accomplish a task, to enable new functionality, or to accommodate an interface change. For example, if the name of a function changes (a rare occurrence, but potentially disruptive when it does happen), the impact on affected code can be minimized by conditionally calling the function by its old or new name using conditional compilation. In the following, the #if preprocessor directive compares BSL_VERSION (i.e., the latest BSL version, excluding the patch version) to a specified major and minor version composed using the BSL_MAKE_VERSION macro:

#if BSL_VERSION > BSL_MAKE_VERSION(1, 3)
// Call 'newFunction' for BSL versions later than 1.3.
int result = newFunction();
#else
// Call 'oldFunction' for BSL version 1.3 or earlier.
int result = oldFunction();
#endif

Macro Definition Documentation

◆ BSL_GET_VERSION_MAJOR

#define BSL_GET_VERSION_MAJOR (   version)    ((version / 1000000) % 100)

Extract from the specified version the corresponding major version. version is the result of a BSL_MAKE_VERSION(major, minor) invocation, and this macro returns major.

◆ BSL_GET_VERSION_MINOR

#define BSL_GET_VERSION_MINOR (   version)    ((version / 100) % 10000)

Extract from the specified version the corresponding minor version. version is the result of a BSL_MAKE_VERSION(major, minor) invocation, and this macro returns minor.

◆ BSL_MAKE_VERSION

#define BSL_MAKE_VERSION (   major,
  minor 
)
Value:
((major) * 1000000 \
+ (minor) * 100)

Construct a composite version number from the specified major and minor version numbers. The result is unique for each combination of major and minor, and is sortable such that a value composed from a given major version number will compare larger than a value composed from a smaller major version number (and similarly for minor version numbers). Note that if major and minor are both compile-time integral constants, then the resulting expression is also a compile-time integral constant. Also note that the patch version number is intentionally not included. The behavior is undefined unless major is an integral value in the range [0 .. 99] and minor is an integral value in the range [0 .. 9999].

◆ BSL_VERSION

#define BSL_VERSION
Value:
#define BSL_VERSION_MAJOR
Provide the major version number of the current (latest) BSL release.
Definition bslscm_versiontag.h:103
#define BSL_VERSION_MINOR
Provide the minor version number of the current (latest) BSL release.
Definition bslscm_versiontag.h:106
#define BSL_MAKE_VERSION(major, minor)
Definition bslscm_versiontag.h:119

Construct an integer (unique to the specified BSL_VERSION_MAJOR and BSL_VERSION_MINOR numbers) corresponding to the major and minor version numbers, respectively, of the current (latest) BSL release. Note that the patch version number is intentionally not included.

◆ BSL_VERSION_MAJOR

#define BSL_VERSION_MAJOR   4

◆ BSL_VERSION_MINOR

#define BSL_VERSION_MINOR   14