Preprocessing in C ++

How to do this, when I define both instructions at the same time, I get a compilation error? I want a mistake here

#define ENG #define POL #if defined POL #if defined ENG 

Not here

 #define ENG //#define POL #if defined POL #if defined ENG 
+4
source share
1 answer
 #if defined( ENG ) && defined( POL ) #error You can't define both! #endif 
+8
source

Source: https://habr.com/ru/post/1440052/


All Articles