Top "C-preprocessor" questions

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

How to know if __uint128_t is defined

We can use the preprocessor to know if unsigned long long is defined: #include <limits.h> #ifndef ULLONG_…

c c-preprocessor 128-bit
Variadic macro trick

What's the trick to create a variadic macro FOO(a1, a2, a3,..., an) such that it expands to FOOn(a1, …

c c-preprocessor variadic-macros
The most useful user-made C-macros (in GCC, also C99)?

What C macro is in your opinion is the most useful? I have found the following one, which I use …

c macros c-preprocessor c99
Naming Include Guards

How are C++ include guards typically named? I tend to see this a lot: #ifndef FOO_H #define FOO_H // ... #…

c++ c-preprocessor include-guards
What are some tricks I can use with macros?

In our legacy code, as well as our modern code, we use macros to perform nifty solutions like code generations, …

c++ c c-preprocessor stringification
Array-size macro that rejects pointers

The standard array-size macro that is often taught is #define ARRAYSIZE(arr) (sizeof(arr) / sizeof(arr[0])) or some equivalent formation. …

c arrays macros c-preprocessor
What C preprocessor conditional should I use for OS X specific code?

What C preprocessor conditional should I use for OS X specific code? I need to include a specific library if …

c macos c-preprocessor conditional-compilation
How do I show the value of a #define at compile time in gcc

So far I've got as far as: #define ADEFINE "23" #pragma message ("ADEFINE" ADEFINE) Which works, but what if ADEFINE isn't …

c gcc macros c-preprocessor pragma
What is the purpose of a single pound/hash sign (#) on its own line in the C/C++ preprocessor?

I have been looking at the Boost libraries source code, and I have noticed that often there are single pound …

c++ c boost c-preprocessor
How to disable NSLog all over the app?

I want to disable NSLog() across all instances in an app. I found some code that does that: #ifndef DEBUG #…

ios objective-c xcode c-preprocessor nslog