Top "C-preprocessor" questions

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

MIN and MAX in C

Where are MIN and MAX defined in C, if at all? What is the best way to implement these, as …

c max min c-preprocessor
What is the difference between #include <filename> and #include "filename"?

In the C and C++ programming languages, what is the difference between using angle brackets and using quotes in an …

c++ c include header-files c-preprocessor
Why are #ifndef and #define used in C++ header files?

I have been seeing code like this usually in the start of header files: #ifndef HEADERFILE_H #define HEADERFILE_H …

c++ c c-preprocessor
__FILE__, __LINE__, and __FUNCTION__ usage in C++

Presuming that your C++ compiler supports them, is there any particular reason not to use __FILE__, __LINE__ and __FUNCTION__ for …

c++ debugging logging c-preprocessor
Combining C++ and C - how does #ifdef __cplusplus work?

I'm working on a project that has a lot of legacy C code. We've started writing in C++, with the …

c++ c c-preprocessor extern-c
Define preprocessor macro through CMake?

How do I define a preprocessor variable through CMake? The equivalent code would be #define foo.

c++ cmake c-preprocessor
#pragma pack effect

I was wondering if someone could explain to me what the #pragma pack preprocessor statement does, and more importantly, why …

c c-preprocessor pragma-pack
#define macro for debug printing in C?

Trying to create a macro which can be used for print debug messages when DEBUG is defined, like the following …

c c-preprocessor
C/C++ macro string concatenation

#define STR1 "s" #define STR2 "1" #define STR3 STR1 ## STR2 Is it possible to concatenate have STR3 == "s1"? You can do …

c++ c c-preprocessor
How to make a variadic macro (variable number of arguments)

I want to write a macro in C that accepts any number of parameters, not a specific number example: #define …

c g++ c-preprocessor variadic