I’d like to produce cross-compiler compatible C++ code.
I’ve produced a somewhat “exotic” code, that push the C++ language in its gray, weird, mysterious areas.
Considering my code only depends on boost and the STL, that the issue is to check code compatibility, and not lib compatibility:
Would my code compiling both msvc and Mingw ensures a 100% that my code is compatible with GCC on every platform?
Not at all.
Compiling your code with MSVC and MinGW guarantees that your code is compatible with Microsoft’s C/C++ libraries. I understand you’re only talking about code compatibility, but such a thing doesn’t exist. If you’re pushing C++ into the gray areas, it might well be that the same code will have different results depending on the platform you compile it on.
The best, and only way to guarantee full compatibility is compiling and testing it on both platforms.
Although using GCC with
-std=c++0X -Wall -Wextra -pedantic(or any other std version) and getting rid of all the warnings will give a pretty good idea of code quality.