A good way to understand what the preprocessor does to your code is to get hold of the preprocessed output and look at it. Also, you should escape your backslash The question is if users can define new macros in a macro, not if they can use macros in macros.
BOLD N' GRACIOUS : Are Metrosexual Men Increasing in our Kenyan Society?
What is the scope of a #define
I have a question regarding the scope of a #define for c/c++ and am trying to bet understand the preprocessor
Let's say i have a project containing multiple sour. 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 You'll need to complete a few actions and gain 15 reputation points before being able to upvote Upvoting indicates when questions and answers are useful What's reputation and how do i get it
Instead, you can save this post to reference later.
I'd like to define and set environment variable between jobs inside my github actions workflow The workflow below is what i've tried but unfortunately the environment variable git_pr_sha_short and #define my_macro printf( \ i like %d types of cheese\n, \ 5 \ ) but you cannot do that with your first example The #define directive is a preprocessor directive
The preprocessor replaces those macros by their body before the compiler even sees it Think of it as an automatic search and replace of your source code 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
You can generally use the ## (double number sign) to concatenates two tokens in a macro invocation
However, since you have string literals jamming an already defined macro, you could just use spaces, else you could run into invalid preprocessing token