gcc version mismatches

Keith J. Schultz keithjschultz at web.de
Thu Nov 17 00:16:45 PST 2011

Hi All,

Generally, mixing compilers should not be a problem to the experienced programmer 
as long as s/he is aware that they are mixing them. 

Naturally, using a single compiler is easier. Yet, as long as you are aware what you are doing and the
"subtleties" of mixing compilers and libraries you are on the safe side.

It is when one starts cutting corners for optimizations needs that you can get into trouble, or
you use a library that is not well documented telling you that it also is mix it and what you should look out for.


Am 17.11.2011 um 05:57 schrieb Mike Alexander:
> Mixing C++ compilers and hence run time libraries can lead to problems. Mixing C compilers is often ok, but C++ is a more complex language and different compilers have different ideas about object construction and destruction, VTable format, and other things that affect the generated code.  In a previous lifetime where I wrote lots of C++ code, I sometimes had to worry about problems like this.  You have to be careful that objects don't leak out of one library (compiled with compiler X) into another library (compiled with compiler Y).  I suspect this isn't a problem with most libraries in MacPorts since the APIs have been designed to avoid problems like this, but it could happen. As long as any object created by a given library is treated as an opaque pointer outside that library, you're probably ok.
> Mixing compilers inside one port is more likely to cause problems.  I think that if a port needs a Fortran compiler it should use the corresponding C and C++ compilers.

More information about the macports-users mailing list