Author of the article: Caspian
Source Website: https://blog.csdn.net/WangPaiFeiXingYuan
macro
#define OFFSET 10000
constant
const int offset=10000;
constant
constexpr int offset = 10000; //C++ 11 标准新添加的关键字
Let’s talk about these three “constants” today.
#define is a grammar belonging to the preprocessor, and it simply performs macro replacement. OFFSET has never been seen by the compiler. During compilation, OFFSET has been replaced by the preprocessor with 10000, so there is no OFFSET in the symbol table, so This can lead to confusion when compiling with error messages that mention 10000 instead of OFFSET. If OFFSET was not written by you, you have no idea where 10000 came from, and you will waste a lot of time tracking down this information. Using const can solve this problem.
const is C++