经常有人要我(Bjarne Stroustrup)推荐一种C++的编译器。但是,我通常不会推荐任何编译器,因为我可能因此而在编译器的商战中表明”立场”。而且我并不是对所有的编译器都了解,C++编译器实在是太多了,我平时会用到半打(6个)C++ 编译器,但那只是”沧海一粟”罢了。
我希望人们在选择自己的编译器时,一定要严格参照现行的C++标准。尽量避免使用不支持或者违背ISO标准的编译器。
你如果是一个初学者而且不知道如何测验一个编译器是否符合标准的话,你可以试试下面这个小程序:
#include <iostream> #include <string> using namespace std; int main() { string s; cout << "Please enter your first name followed by a newline\n"; cin >> s; cout << "Hello, " << s << '\n'; return 0; // this return statement isn't necessary } |
假如你的编译器无法正常运行这段简单的代码的话,那么它不应该是你学习标准C++的一种好的选择。
虽然有些过时,但还是要推荐一篇较详尽的介绍标准的文章和boost.org的编译器的页面。符合标准只是评价一个编译器品质的一个方面,其他还包括:生成代码的质量,生成的错误信息,编译速度,集成的工具,厂商支持的力度,向后兼容性等等等等。不过,和标准的一致性确实是相当重要的一个方面。另外,一些编译器提供它自己对语言的一些扩展,使用这些扩展的特性将降低你的代码的可移植性,当你换用其他编译器是也会比较困难。
当在网络上寻找编译器时,你会发现,很多信息被各种各样的产品名称掩盖了。这里,我搜集了一些C++编译器。其中有一些是可以免费下载的:
- Apple C++. It also comes with OS X on the developer tools CD.
- Bloodshed Dev-C++. A GCC-based (Mingw) IDE.
- Borland C++
- Cygwin (GNU C++)
- Digital Mars C++
- MINGW – “Minimalist GNU for Windows”. Another GCC version for Windows including a free (non-GPL) w32api.
- DJ Delorie’s C++ development system for DOS/Windows (GNU C++)
- GNU CC source
- IBM C++ for IBM power, System Z, Bluegene, and Cell.
- Intel C++ for linux
- The LLVM Compiler Infrastructure (based on GCC).
- Microsoft Visual C++ 2008 Express edition.
- Sun Studio.
另外一些是需要付费才可使用的:
- Borland C++
- CodeWarrior C++ (formerly Metrowerks), it comes for many platforms.
- Comeau C++ for many platforms
- Edison Design Group C++ Front End – used by many C++ compiler suppliers
- Green Hills C++ for many embedded systems platforms
- HP C++ for Unix and HP C++ for OpenVMS.
- Intel C++ for Windows, Linux, and some embedded systems.
- Mentor Graphics/Microtec Research C++ for many embedded systems platforms
- Microsoft C++
- Paradigm C++, for x86 embedded systems
- The Portland Group C++ (parallization for Pentiums)
- SGI C++, optimizing compiler
- Sun C++
- WindRiver’s Diab C++ used in many embedded systems.
[tip]This is a translation from Bjarne Stroustroup[/tip]
你好!除了代码,此处没有多少原创之物,皆为本人搜集、整理、总结之记录与心得,欢迎转载分享!转载时请尽量注明出处,将不胜感激。祝你健康、快乐!
Be the first to comment on this entry.