A
Alex Vinokur
Hi,
Hi,
Different C/C++-preprocessors have diffrerent behavior on this program.
Is there any preprocessor standard for this case?
// ========================
// File foo.cpp
#define MACRO1(x) x
#define MACRO2(x) x
int main()
{
MACRO1(
#if 1
MACRO2("ABC")
#else
MACRO2("XYZ")
#endif
);
return 0;
}
// ========================
========= Linux =========
// Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.0.4.191 Build 20110427
----- Output of preprocessing -----
# 1 "foo.cpp"
int main()
{
"ABC";
# 13 "foo.cpp"
return 0;
}n 0;
}
========================
========= Windows =========
// Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
----- Output of preprocessing -----
#line 1 "foo.cpp"
int main()
{
#if 1 "ABC" #else "XYZ" #endif;
#line 13 "foo.cpp"
return 0;
}
===========================
Hi,
Different C/C++-preprocessors have diffrerent behavior on this program.
Is there any preprocessor standard for this case?
// ========================
// File foo.cpp
#define MACRO1(x) x
#define MACRO2(x) x
int main()
{
MACRO1(
#if 1
MACRO2("ABC")
#else
MACRO2("XYZ")
#endif
);
return 0;
}
// ========================
========= Linux =========
// Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.0.4.191 Build 20110427
icpc -E foo.cpp
----- Output of preprocessing -----
# 1 "foo.cpp"
int main()
{
"ABC";
# 13 "foo.cpp"
return 0;
}n 0;
}
========================
========= Windows =========
// Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
cl /E foo.cpp
----- Output of preprocessing -----
#line 1 "foo.cpp"
int main()
{
#if 1 "ABC" #else "XYZ" #endif;
#line 13 "foo.cpp"
return 0;
}
===========================