Top "C-preprocessor" questions

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

Standard alternative to GCC's ##__VA_ARGS__ trick?

There is a well-known problem with empty args for variadic macros in C99. example: #define FOO(...) printf(__VA_ARGS__) #define …

c c99 c-preprocessor variadic-macros
Multi line preprocessor macros

How to make multi line preprocessor macro? I know how to make one line: #define sqr(X) (X*X) but …

c++ c c-preprocessor
How to concatenate twice with the C preprocessor and expand a macro as in "arg ## _ ## MACRO"?

I am trying to write a program where the names of some functions are dependent on the value of a …

c concatenation token c-preprocessor
What are the applications of the ## preprocessor operator and gotchas to consider?

As mentioned in many of my previous questions, I'm working through K&R, and am currently into the preprocessor. …

c c-preprocessor kernighan-and-ritchie stringification
Are typedef and #define the same in c?

I wonder if typedef and #define are the same in c?

c macros c-preprocessor typedef
Which Cross Platform Preprocessor Defines? (__WIN32__ or __WIN32 or WIN32 )?

I often see __WIN32, WIN32 or __WIN32__. I assume that this depends on the used preprocessor (either one from visual …

c++ macros c-preprocessor
"#include" a text file in a C program as a char[]

Is there a way to include an entire text file as a string in a C program at compile-time? something …

c include c-preprocessor
Overloading Macro on Number of Arguments

I have two macros FOO2 and FOO3: #define FOO2(x,y) ... #define FOO3(x,y,z) ... I want to define …

c macros c-preprocessor
Should I use #define, enum or const?

In a C++ project I'm working on, I have a flag kind of value which can have four values. Those …

c++ enums bit-manipulation c-preprocessor
Should I use #include in headers?

Is it necessary to #include some file, if inside a header (*.h), types defined in this file are used? For …

c c-preprocessor file-organization