GCC features superior multi-platform compiler detailed

Source: Internet
Author: User
Keywords Multi-platform GCC compiler superior performance
Tags aliyun apache c compiler code community compile compiler cpp

Inadvertently, GCC has developed a version of 4.3, although there is no question of the software http://www.aliyun.com/zixun/aggregation/36661.html "> Outside the development community, But because GCC is used in almost all open source and free software, the fluctuations in its compiler performance directly affect the development of thousands of of projects, such as Linux, Firefox and even OpenOffice.org and Apache. So putting GCC at the heart of Open-source software is not a bit too important. On the other hand, the emergence of GCC4.3, is drawing the hearts of the vast number of programmers. If we have to use a word to illustrate the relationship between GCC and programmers, it is undoubtedly "heart".

As the flagship of free software, Richard Stallman, who started writing GCC more than 10 years ago, just used it as a compiler for a C-program language; GCC means only GNU c Compiler. After so many years of development, GCC has not only been able to support the C language; it now supports the ADA, C + +, Java, objective C, Pascal, COBOL, and Mercury languages that support functional programming and logical programming, and so on. And GCC is no longer just the GNU C compiler, it becomes the GNU Compiler Collection is the GNU compiler family meaning. On the other hand, when it comes to GCC support for a variety of hardware platforms, it is summed up as a word: ubiquitous. Almost all of the hardware platforms that have a little practical use, even some less practical hardware platforms.

The GCC (GNU C Compiler) under the Linux system is a powerful, performance-enabled multiplatform compiler for GNU, one of the works of the GNU representative. GCC is a super compiler that can compile executable programs on a variety of hardware platforms, and its execution efficiency is 20%~30% higher than average compiler efficiency.
Official website: http://gcc.gnu.org/

GCC is the only compiler for Linux, and the importance of LINUX,GCC without GCC is ineffable. It is so important that we should study it well. OK, let's start our GCC trip!

First of all, eliminate GCC and g++ misunderstanding.
GCC and g++ are all GNU (organization) compilers.

Myth One: gcc can only compile C code, g++ can only compile C + + code

Both are possible, but please note:
1. The suffix is. c, and GCC treats it as a C program, and g++ is a C + + program; the suffix is. cpp, both of which are considered C + + programs, note that although C + + is a superset of C, there is a difference between the requirements for syntax, for example:
#include <stdio.h>
int main (int argc, char argv]) {
if (argv = = 0) return;
Printstring (argv);
Return;
}
int printstring (char string) {
sprintf (String, "This is a test." n ");
}
If you follow the grammar rules of C, OK, no problem, but, once the suffix to CPP, immediately reported three wrongs: "Printstring undefined";
"Cant convert ' char** ' to ' char";
"Return-statement with no value";
Corresponding to the previous Red callout section. Visible C + + syntax rules more rigorous.

2. The compile phase, g++ will call GCC, for C + + code, the two are equivalent, but because the GCC command is not automatic and C + + program use of the library join, so often use g++ to complete the link, for the sake of unification, simply compile/link all use g++, this gives a person an illusion, As if the CPP program can only use g++-like.

Myth Two: GCC does not define __cplusplus macros, and g++

In fact, the macro simply indicates that the compiler will interpret the code in C or C + + syntax, as described above, if the suffix is. C and the GCC compiler is used, the macro is undefined, otherwise it is defined.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.