I know that in principle this is probably undefined behaviour, but in the interest of dealing with a large project, here's my question about GCC:
Suppose I compile one transation unit with gcc -std=c++98
, and another with -std=c++11
, using the exact same compiler installation. Is there any sort of guarantee that I can link the two object files and obtain a well-defined program?
As far as I can tell, the potential problems can only come from different views of the library headers due to differing macros, and those in turn would at best add new member functions, but never member objects, to the standard library classes.
Would this somehow make it acceptable to compile different parts of a larger project with different language dialect options?
Update: I should add an orthogonal question: What about using two different versions of GCC (say 4.3 and 4.6), but wht the same dialect option (-std=c++98
)? The listing in this GCC documentation seems to suggest that the library is compatible in both directions between 4.2.2 and 4.6.