8.1 Compiler Differences

GCC is supported on a wide range of platforms, and it is the default compiler on Mac OS X. There are, however, some important differences between the version of GCC that ships with Mac OS X and that found on other Unix systems.

One difference that experienced GCC users may notice, particularly if they have dealt with a lot of mathematical and scientific programming, is that the Xcode Tools do not include FORTRAN. However, the Fink distribution (http://fink. sourceforge .net) includes g77 , the GNU FORTRAN 77 compiler. Also, the Darwin archive includes the source code for g77 , which you can use to compile FORTRAN code.

Mac OS X's C compiler contains a number of Mac-specific features that have not been folded into the main GCC distribution. (It is up to the Free Software Foundation [FSF] to accept and merge Apple's patches.) For information on how Apple's compiler differs from the GNU version, see the README.Apple file in the Darwin CVS archive's gcc3 subdirectory.


As of this writing, Apple's cc compiler is based on GCC 3.3. However, GCC 3.1 and 2.95 are also available as /usr/bin/gcc2 , and /usr/bin/gcc3 , respectively. By default, invoking cc or gcc invokes GCC 3.3; both /usr/bin/cc and /usr/bin/gcc are symbolic links to /usr/bin/gcc3.3 . You can change the default GCC to GCC 2.95 or GCC 3.1 by running the command gcc_select 2 , or gcc_select 3 , respectively. Similarly, you can change it back to GCC 3.3 with gcc_select 3.3 . The gcc_select command (used with one of the options 2, 3, and 3.3) changes the symbolic links /usr/bin/cc and /usr/bin/gcc to point to the desired version of gcc. Since files in /usr/bin are changed by this command, you must execute it with sudo .

You can see the current settings by running gcc_select with no arguments:

 $  gcc_select  Current default compiler: gcc version 3.3 20030304 (Apple Computer, Inc. build 1495) 

You can find the Mac OS X Compiler Release Notes on your system at /Developer/Documentation/ReleaseNotes/CompilerTools.html . You should consult these release notes for details on the most current known problems, issues, and features.


8.1.1 AltiVec

The Motorola AltiVec Velocity Engine is also supported for G4 processors by the Mac OS X GCC implementation. The compiler flag - faltivec must be specified to compile code engineered to use the Velocity Engine. Inclusion of this command-line option to cc defines the preprocessor symbol _ _VEC_ _ .



Mac OS X Panther for Unix Geeks
Mac OS X Panther for Unix Geeks
ISBN: 0596006071
EAN: 2147483647
Year: 2003
Pages: 212

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net