Top "C-preprocessor" questions

A textual macro processor applied before compiling C and C++ language programs.

How to use Macro argument as string literal?

I am trying to figure out how to write a macro that will pass both a string literal representation of …

c++ c-preprocessor string-literals
How do I make a C++ macro behave like a function?

Let's say that for some reason you need to write a macro: MACRO(X,Y). (Let's assume there's a good …

c++ c-preprocessor
How do I show the value of a #define at compile-time?

I am trying to figure out what version of Boost my code thinks it's using. I want to do something …

macros c-preprocessor boost-preprocessor
Can gcc output C code after preprocessing?

I'm using an open source library which seems to have lots of preprocessing directives to support many languages other than …

c c-preprocessor preprocessor preprocessor-directive
How to add a 'or' condition in #ifdef

How can I add a 'or' condition in #ifdef ? I have tried: #ifdef CONDITION1 || CONDITION2 #endif This does not work.

c-preprocessor
How to identify platform/compiler from preprocessor macros?

I'm writing a cross-platform code, which should compile at linux, windows, Mac OS. On windows, I must support visual studio …

c++ macros cross-platform c-preprocessor
How to make a char string from a C macro's value?

For example, how to avoid writing the 'func_name' twice? #ifndef TEST_FUN # define TEST_FUN func_name # define TEST_…

c c-preprocessor dry
Why use #define instead of a variable

What is the point of #define in C++? I've only seen examples where it's used in place of a "magic …

c++ c-preprocessor
How to compare strings in C conditional preprocessor-directives

I have to do something like this in C. It works only if I use a char, but I need …

c conditional c-preprocessor
Easy way to use variables of enum types as string in C?

Here's what I am trying to do: typedef enum { ONE, TWO, THREE } Numbers; I am trying to write a function …

c enums c-preprocessor