Top "C-preprocessor" questions

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

C Macros to create strings

Alternative Titles (to aid search) Convert a preprocessor token to a string How to make a char string from a …

c macros c-preprocessor stringification
What exactly do C include guards do?

I have a question regarding include guards in C. I've done a bit of reading but would appreciate a little …

c macros c-preprocessor header-files include-guards
Why do all the C files written by my lecturer start with a single # on the first line?

I'm going through some C course notes, and every C program source file begins with a single # on the first …

c c-preprocessor
Real-world use of X-Macros

I just learned of X-Macros. What real-world uses of X-Macros have you seen? When are they the right tool for …

c macros c-preprocessor x-macros
Is there a good reason for always enclosing a define in parentheses in C?

Clearly, there are times where #define statements must have parentheses, like so: #define WIDTH 80+20 int a = WIDTH * 2; // expect a==200 but …

c c-preprocessor parentheses
C/C++, can you #include a file into a string literal?

I have a C++ source file and a Python source file. I'd like the C++ source file to be able …

c++ c include c-preprocessor string-literals
Determine #defined string length at compile time

I have a C-program (an Apache module, i.e. the program runs often), which is going to write() a 0-terminated …

c macros c-preprocessor c-strings strlen
C Preprocessor testing definedness of multiple macros

I searched the site but did not find the answer I was looking for so here is a really quick …

c c-preprocessor logical-operators preprocessor-directive
Adding quotes to argument in C++ preprocessor

I'd like to pass the name of an include file as a compiler argument so that I can modify a …

c++ c-preprocessor double-quotes
Variadic recursive preprocessor macros - is it possible?

I've run into a little theoretical problem. In a piece of code I'm maintaining there's a set of macros like #…

macros c-preprocessor