C++ – How to use preprocessor if statements(#if, #elif, #endif) inside a macro?

I am currently developing a program that I intend to be portable. I have access to both Windows and macOS, and I would like to be able to debug easily on both. When error handling, I want to have debug breaks in there to make it easy(__debugbreak() for MSVC). Since I intend to develop and… Read More C++ – How to use preprocessor if statements(#if, #elif, #endif) inside a macro?

Is there a way to define a preprocessor macro that includes preprocessor directives?

There are a few loops I would like to direct the compiler to unroll with code like below. It is quite long and I’d rather not copy-paste. Can #define statements define preprocessor macros? I tried this: #define foo \ #ifdef __GNUC__ \ #if __GNUC__ >= 8 \ #pragma GCC unroll 128 \ #pragma GCC ivdep… Read More Is there a way to define a preprocessor macro that includes preprocessor directives?