The Arduino forum is generally for MCU boards and software manufactured and distributed by Arduino.
Other manufacturers and volunteers have modified the Arduino IDE to work with their compilers and linkers, and nothing is guaranteed to work as it does (well, if it does) with Arduino boards. You might try the ESP32 forum.
Meh. Even though they have the same name, the Arduino project is much bigger than the Arduino company. All things related to the Arduino project are welcome here. And in the case of the ESP32, many of the official boards actually have an ESP32 microcontroller in their WiFi modem.
But this question is not even specific to any one microcontroller. This is about C++.
From § 16.1 ¶4 of the C++11 standard:
After all replacements due to macro expansion and the defined unary operator
have been performed, all remaining identifiers and keywords, except for true and false, are replaced with the pp-number 0
So what that means is your conditional is equivalent to this:
Wow- make a newcomer feel unwelcome, why don't you?
This is the first time Connetsrl has posted — let’s welcome them to our community!
There is absolutely NOTHING in Connestri's question that is restricted to Arduino boards only that rates this kind of dismissal. Preprocessor statements in the Arduino IDE work the same whether it's an Arduino board or an ESP board.
#define TEST pillo
#if TEST == pillo
#elif TEST == pollo
// other stuff
#error undefined test
the current Optiboot source code uses this extensively to allow compile time naming of chip pins like avr-gcc optiboot.c -DLED=B5 -DUARTRX=D0 and similar. It's "ugly" in the implementation (10 ports with ~8 bits each makes for #elif chains 500+ lines long!), but it's not difficult to implement (a good editor with macro capabilities helps a lot), and it makes things much easier for the "user."