A simple comparison between clang and GCC compilers

Source: Internet
Author: User

The main collation of a discussion on self-knowledge:

Currently the industry's three major C + + compilers: visualc++, g++, clang++. visualc++ The main advantage is the graphical interface, debugging is convenient, but the available platform is very limited. This is mainly compared to g++ and clang++.

the advantages of clang than GCC compilers:

· Faster compilation speed

· Smaller compilation output

· The error message is more user-friendly, such as clang can directly point to the relative simplicity of the error location in the compilation process and the way it "thinks" it is right.

· There is a built-in static analysis tool that allows static analysis of code (CLANG-ANALYZE). That's what GCC can't do.

· Because clang only need to complete lexical and grammatical analysis, code optimization and machine code generation work is done by LLVM. So, compared to all the GCC packages, clang can do one thing more intently. This structure also allows clang to be used separately for other applications, as well as embedded C/s + + parser for other apps (primarily the IDE). Code completion and refactoring are important features for the IDE, but if there is no underlying support, only tags parsing or regular expression matching is difficult to achieve, clang is just the role. In this way, the editor tool can use the same parser as compiler to complete the edit-time syntax check. And GCC won't be able to do that easily. For historical reasons, GCC is a single executable compiler that completes the process from preprocessing to final code generation, with many of the information not being reused by other programs.

the advantages of GCC:

· Some software can be clang compiled with a baffling error, but compiling with GCC is possible.

· GCC has been preparing to use C + + for modularity until 5.0, expecting a breakthrough in GCC's 5.0 to make up for a short board that cannot be modularized.

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.