한국어

네트워킹

온누리070 플레이스토어 다운로드
    acrobits softphone
     온누리 070 카카오 프러스 친구추가온누리 070 카카오 프러스 친구추가친추
     카카오톡 채팅 상담 카카오톡 채팅 상담카톡
    
     라인상담
     라인으로 공유

     페북공유

   ◎위챗 : speedseoul


  
     PAYPAL
     
     PRICE
     

pixel.gif

    before pay call 0088 from app


Which is better, GCC or Clang?


  • GCC supports languages that clang does not aim to, such as Java, Ada, FORTRAN, Go, etc.
  • GCC supports more targets than LLVM.
  • GCC supports many language extensions, some of which are not implemented by Clang. For instance, in C mode, GCC supports nested functions and has an extension allowing VLAs in structs.

Pro's of clang vs GCC:

  • The Clang ASTs and design are intended to be easily understandableby anyone who is familiar with the languages involved and who has a basic understanding of how a compiler works. GCC has a very old codebase which presents a steep learning curve to new developers.
  • Clang is designed as an API from its inception, allowing it to be reused by source analysis tools, refactoring, IDEs (etc) as well as for code generation. GCC is built as a monolithic static compiler, which makes it extremely difficult to use as an API and integrate into other tools. Further, its historic design and current policy makes it difficult to decouple the front-end from the rest of the compiler.
  • Various GCC design decisions make it very difficult to reuse: its build system is difficult to modify, you can't link multiple targets into one binary, you can't link multiple front-ends into one binary, it uses a custom garbage collector, uses global variables extensively, is not reentrant or multi-threadable, etc. Clang has none of these problems.
  • Clang does not implicitly simplify code as it parses it like GCC does. Doing so causes many problems for source analysis tools: as one simple example, if you write "x-x" in your source code, the GCC AST will contain "0", with no mention of 'x'. This is extremely bad for a refactoring tool that wants to rename 'x'.
  • Clang can serialize its AST out to disk and read it back into another program, which is useful for whole program analysis. GCC does not have this. GCC's PCH mechanism (which is just a dump of the compiler memory image) is related, but is architecturally only able to read the dump back into the exact same executable as the one that produced it (it is not a structured format).
  • Clang is much faster and uses far less memory than GCC.
  • Clang has been designed from the start to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. Modern versions of GCC have made significant advances in this area, incorporating various Clang features such as preserving typedefs in diagnostics and showing macro expansions, but GCC is still catching up.
  • GCC is licensed under the GPL license. clang uses a BSD license,which allows it to be embedded in software that is not GPL-licensed.
  • Clang inherits a number of features from its use of LLVM as a backend, including support for a bytecode representation for intermediate code, pluggable optimizers, link-time optimization support, Just-In-Time compilation, ability to link in multiple code generators, etc.
  • Clang's support for C++ is more compliant than GCC's in many ways.
  • Clang supports many language extensions, some of which are not implemented by GCC. For instance, Clang provides attributes for checking thread safety and extended vector types.

So, As a final thought, I think clang is better. Clang is backed by Google, Apple and Microsoft too. Latest version of clang is 5.0 and Clang AST is more advanced used by professional and Clang tooling is cool also. For example, Clang-format works great with vim and emacs. Clang error message and warnings is more robust than GCC. Clang has thread sanitizer, ASAN(Address sanitizer), MSAN and finally LLVM(low level virtual machine) compiler infrastructure project is really cool.

Barry Rountree

If you’re doing compiler research, LLVM/Clang is much, much easier to modify as plugins were part of the original architecture.

If you’re wanting faster binaries, there’s no substitute for trying them both and measuring the results.

Anton Carver

I assume you mean G++ (not GCC which is either the C compiler or the whole compiler system).

G++ still tends to generate slightly faster code for most cases. Clang tends to be much stricter about conformance to the standard (though G++ seems to be getting better). Clang / LLVM is generally more tool friendly, if you are interested in manipulating C++ code in a tool. GCC is GPL and Clang is BSD License.

There isn’t much in it really, they are both pretty good

조회 수 :
63266
등록일 :
2018.06.13
14:25:20 (*.160.88.18)
엮인글 :
http://www.webs.co.kr/index.php?document_srl=3316316&act=trackback&key=e01
게시글 주소 :
http://www.webs.co.kr/index.php?document_srl=3316316
List of Articles
번호 제목 글쓴이 날짜sort 조회 수
123 Name Server 설정및 이해 admin 2011-12-13 31467
122 서버이전시 고려할 사항들 admin 2011-12-13 83828
121 리눅스 tar 압축 백업복원시 소유자 문제해결 admin 2011-12-16 37159
120 ftp 파일전송 여러파일을 한번에 통째로 전송 admin 2011-12-16 37772
119 리눅스 서버 이전시 고려할 사항들 admin 2011-12-16 130458
118 How to disable IPv6 in Debian , 리눅스 아이피설정 admin 2011-12-16 45048
117 파이썬 설치 및 사용하기 admin 2011-12-16 108793
116 윈도우 2003 작업 스케줄러 설정 admin 2011-12-16 47386
115 무료백신 여러가지 분류해놓은곳 admin 2011-12-16 30538
114 스트리밍서버 / 윈도우서버 admin 2011-12-16 37671
113 Wireshark admin 2011-12-16 30237
112 모든 CPU 벤치마크 수치 admin 2011-12-16 40954
111 다양한 사운드 파일있는곳 admin 2011-12-19 30105
110 리눅스 네트워크 설정 LINUX admin 2011-12-19 41710
109 How to disable IPv6 in Debian Lenny and Squeeze admin 2011-12-29 45278
108 linux 파티션 디렉토리 용량 확인방법 전체 폴더 크기 사이즈 admin 2012-01-05 40725
107 검색 파일리스트 만든 다음 여러파일 한방에 압축하기 admin 2012-02-14 33137
106 Linux 시스템 백업과 복원 admin 2012-02-28 77563
105 Centos net install web http admin 2012-03-02 81989
104 리눅스의 막강한 네트워크 필터 iptables admin 2012-04-15 31628
103 [Linux/SSL] 리눅스 서버에 Apache 2 설치 및 SSL 설정하기(mod_ssl, openssl) admin 2012-04-15 42503
102 scp, ssh, rsync등을 사용할때에 SSH 비밀번호 묻는것 피하기 admin 2012-04-15 41203
101 한국인/국내기업은 얼마나 Linux Kernel에 기여할까? admin 2012-04-29 77187
100 윈도우XP 알면 정말 편한 숨겨진 기능 60가지 admin 2012-05-11 86315
99 WinXP 부팅안되는 현상 NTLDR is missing 메세지 admin 2012-07-12 36456
98 Site builder shootout: Drupal vs. Joomla vs. WordPress admin 2012-07-15 146098
97 Debian CD DVD 다운로드 링크 헤메지말고 바로 다운로드하지요 admin 2012-08-18 39079
96 리눅스에 RADIUS 서버 구현하기 admin 2012-09-01 225778
95 FREE RADIUS 활용및 응용 admin 2013-02-23 47176
94 Deploying FreeRADIUS with the MySQL Cluster Database file admin 2013-03-22 37202