Binary files do not match, because you defined STD in one, and not in the other. I also get different sizes.
However, if you strip characters, you will get almost identical binaries (which distinguishes some parameters of the ELF header, for example, compilation time).
If you change the example:
#include<iostream> using namespace std; int main() { #if 0 std::cout<<"\n ==> Workign \n"; #else cout<<"\n ==> Workign \n"; #endif return 0; }
and then compiled with #if 1 and #if 0 , you will get binary files of the same size, even without alternating characters.
The difference in compilation time is normal. When a macro is defined, the file is larger and the preprocessor needs to do more. However, the new PCs are so powerful that I simply ignore this increase in time.
source share