GNU Compiler Collection

From Cppwiki

Jump to: navigation, search

The GNU Compiler Collection (GCC - uppercase) is a suite of compilers released by the GNU project. It includes a C compiler (gcc - lowercase) and a C++ compiler (g++), as well as compilers for other languages like Fortran, Java and Ada. GCC is purely a compiler; it does not include an Integrated Development Environment (IDE), a debugger, etc. (However, the GNU project also has a debugger, gdb).

GCC runs on Unix (including Linux), on Windows (as a native port called MinGW, as a POSIX-emulation layer called Cygwin, and under Microsoft Services for Unix, the native POSIX layer for Windows NT), on MacOS X (a modified version of GCC from Apple is distributed with MacOS X), and on several other platforms.

Since version 3.1 (and particularly since 4.0), GCC is a capable C++ compiler, providing good standards conformance. Although GCC provides reasonable performance on most platforms, it is often inferior to native compilers. For example, Microsoft Visual C++ and the Intel C/C++ compiler often produce faster code on Intel IA-32 systems, and Sun Microsystems' Sun Studio compiler is usually faster on SPARC platforms. Despite this, GCC is a good choice for code which has to target multiple platforms where performance is not critical.

GCC includes many extensions to standard C++; several other "GCC-compatible" compilers (usually those which run under Linux), such as the Intel C/C++ compiler and Sun Studio, also implement these extensions.

Notable language extensions

attribute syntax (main article: GCC attributes
gcc allows identifiers (such as functions, variables, etc) to be given special attributes; for example, a function can be declared to take a printf-style argument list (which will cause the compiler to warn about certain format string errors), or that it never returns or returns twice (which can help the optimiser). gcc uses attributes where other compilers would typically use #pragma.
explicit template instantiation 
GCC allows template specialisations to be declared in headers and defined in source files. this is used for commonly-used templates, such as iostreams and std::string, which are most often only instantiated over a limited set of types, to prevent the compiler having to emit compiled code for them in every module.

External links

Personal tools