开发者

Is there any alternative to gcc to do pratical development under *nix? [closed]

开发者 https://www.devze.com 2022-12-11 09:03 出处:网络
Closed. This question does not meet S开发者_StackOverflowtack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet S开发者_StackOverflowtack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

Improve this question

I have once heard a saying,we could live without linux, but we definitely could not live without gcc. It seems, there is only one C compiler in the Linux world. Is there any alternatives to gcc? Do programmers under AIX/HPUX/Solaris use only gcc to develop programs?


There's certainly at least one alternative to gcc on Linux: clang is a C-compiler (and related dialects, although as far as I can see, the C frontend is much more mature than the other dialects) utilising LLVM. Apple supports the development of LLVM & friends, I think; it's useful for their Grand Central Dispatch/OpenCL stuff, IIRC.


Intel has a "non-commercial" C++ compiler here. Make sure you read the license faq here it does come with strings attached.

Here is a list that might be of some help.


If you are looking for a lightweight and fast C compiler TinyCC (see also Wikipedia) is definitely worth a look.

There are some downsides, though. It only performs very few optimizations and the latest stable version only supports the x86 architecture although there is already experimental x86_64 support in the development branch.

For now, I would probably stick with GCC for any serious programs considering these flaws of TinyCC.

The only use-case where TCC could come in really handy nowadays is to use it as an interpreter for C code. I have not measured the performance but I can imagine that a small "script" in C can smootly compete with Bash code (in terms of parsing and execution speed).

The developers even succeeded in interpreting a Linux 2.4 kernel in realtime and boot it right away! There is an ISO image floating around which just works perfectly in Qemu.

As GCC is based on code that dates back several decades ago when there was not much knowledge on code structuring, appropriate use of design patterns etc., the GCC developers are maintaining a rusty and error-prone basis. Unfortunately the code is mess and there is no alternative to a complete rewrite. That probably also the reason why the developers of LLVM also came up with Clang and started from ground-up. In the long-term I really hope that there is going to be a proper replacement for GCC which does everything conceptually right from the beginning. Clang sounds like a worthy replacement although I am not completely comfortable with their choice of using C++ but that is another topic. :)


Consider PathScale Path64 compiler and Open64. Solid, open source, with a long history. Quite popular in high-performance computing, and also a good platform for academic research.

https://github.com/path64/compiler

http://www.open64.net/


There is also libfirm/cparser which implements most gcc extensions and generates optimized code (currently for x86 32bit and sparc): http://pp.ipd.kit.edu/firm/


Sun Studio 12 is now available as a free download for Linux (X86 flavors, at least) and all Solaris variants. I don't know how the X86/Linux version of the compiler compares, but the Sparc/Solaris version of the compiler is capable of producing significantly more optimized code than GCC, and the debugger is far more powerful than GDB. The downside is that you get stuck with a sluggish Java based GUI for the debugger.

0

精彩评论

暂无评论...
验证码 换一张
取 消