<<Hands-on OpenCV source code>>---CV_VERSION

Hello everyone, CV friends, today I decided to update an OpenCV basic source code every day, starting from the most basic, welcome friends to forward and collect, please criticize and correct if it is unreasonable

#include "opencv2/core/version.hpp"

#ifndef OPENCV_VERSION_HPP
#define OPENCV_VERSION_HPP

#define CV_VERSION_MAJOR    4
#define CV_VERSION_MINOR    6
#define CV_VERSION_REVISION 0
#define CV_VERSION_STATUS   ""

#define CVAUX_STR_EXP(__A)  #__A
#define CVAUX_STR(__A)      CVAUX_STR_EXP(__A)

#define CVAUX_STRW_EXP(__A)  L ## #__A
#define CVAUX_STRW(__A)      CVAUX_STRW_EXP(__A)

#define CV_VERSION          CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS

/* old  style version constants*/
#define CV_MAJOR_VERSION    CV_VERSION_MAJOR
#define CV_MINOR_VERSION    CV_VERSION_MINOR
#define CV_SUBMINOR_VERSION CV_VERSION_REVISION

#endif // OPENCV_VERSION_HPP

explain:

#Convert macro parameters to strings during precompilation;

Macro connector##       

It is used to connect two substrings (tokens) in a macro definition with parameters to form a new substring; but it cannot be the first or last substring. The so-called substring (token) refers to the smallest syntax unit that the compiler can recognize. However, "##" cannot be arbitrarily glued to any character, and must be a legal C language identifier. In a single macro definition, the "#" or "##" preprocessing operator can appear at most once. Problems arise if the order of evaluation associated with the '#' or '##' preprocessing operators is not specified.

Guess you like

Origin blog.csdn.net/weixin_56819992/article/details/131119682