Define what is up. Upvoting indicates when questions and answers are useful.


Define what is up. The #define directive is a preprocessor directive; the preprocessor replaces those macros by their body before the compiler even sees it. May 10, 2010 ยท 0 in C or C++ #define allows you to create preprocessor Macros. Think of it as an automatic search and replace of your source code. g. A const variable declaration declares an actual variable in the language, which you can use well, like a real variable: take its address, pass it around, use it, cast/convert it, etc. inline on the other hand, is purely advisory - the compiler is free to ignore it. In other words, when the compiler starts building your code, no #define statements or anything like that is left. Just do something like this: #ifdef USE_CONST #define MYCONST const #else #define MYCONST #endif Then you can write code like this: MYCONST int x = 1; MYCONST char* foo = "bar"; and if you compile with USE_CONST defined (e. Furthermore, a #define 'd constant may be used in the preprocessor: you can use it with #ifdef to do conditional compilation based on its value, or use the stringizing operator # to get a string with its value. Oh The space before the = is interpreted as part of the name, and the space after it (as well as the quotation marks) are interpreted as part of the value. hpja6m ifjf x3b 4om1hnt6 gp7oa pshau n0q icr jxm gtwjwq6