Running the following code
#include <iostream> #define FOO #define BAR defined(FOO) int main() { #if BAR std::cout << "BAR enabled!" << std::endl; #else std::cout << "BAR disabled!" << std::endl; #endif return 0; }
in Visual Studio displays Bar disabled! , running the same code in gcc or clang displays Bar enabled! .
Is this a bug in the Microsoft compiler? What is the standard?
source share