C語言是開源的嗎?C++是開源的嗎?C語言、C++是兩個開源的標准,而不是開源軟件或其它


  我一度對於C語言與C++是不是開源語言很困惑:為什么有那么多人鼓吹Java、Python、PHP等是開源語言,卻沒有人提C與C++開源與否呢?今天在stackoverflow上找到了幾個比較滿意的回答,特寫篇博文總結一下老外的回答,也供各位對此問題持疑問態度的朋友一個參考。

  關於C語言開源與否:

  C語言是一個由ISO組織中的ANSI制定的標准,任何個人或者組織都可以根據這個標准將其實現。現今,世界上有許多不同的C語言實現,比較著名的有:GCC、Watcom、MS C等,其中前兩者是開源的,后者是閉源的。下面粘貼幾個老外的回答(鏈接:https://stackoverflow.com/questions/5099384/is-c-open-source):

1 The C language is not a piece of software but a defined standard, so one wouldn't say that it's open-source, but rather that it's an open standard. 2 
3 There are a gazillion different compilers for C however, and many of those are indeed open-source. The most notable example is GCC's C compiler, which is all under the GNU General Public License (GPL), an open-source license. 4 
5 There are more options. Watcom is open-source, for instance. There is no shortage of open-source C compilers, but without a doubt the most widespread one, at least in the non-Windows world, is GCC. 6 
7 For Windows, your best bet is probably Watcom or GCC by using Cygwin or MinGW.

 

1 C is a standard which specifies how C compilers should generate programs. 2 C itself doesn't have any source code, just like a musical note doesn't have any plastic. 3 
4 Some C compilers, such as GCC, are open source.

 

1 C is just a language, and a standardised one at that, too. It pretty much is the compiler that "does all the work". Different compilers did have different dialects; before the the C99 ANSI standard, you had things like Borland C and other competing compilers, that implemented the C language in their own fantastic ways. 2 
3 stdlib is just an agreed-upon collection of standard libraries that are required to be present in any ANSI C implementation.

 

  關於C++開源與否:

  與C語言類似,C++也是由ISO/ANSI制定的一個標准,所謂的“官方”並未提供確切的實現,任何組織與個人都可以根據標准自己開發一個C++編譯器出來。出名的C++編譯器有:GCC/G++、libc/libc++、clang(++)、 Visual studio和MS´ runtime等。也把老外的幾個回答貼出來(鏈接:https://stackoverflow.com/questions/22589213/is-c-an-open-source-project-which-community-developes-it):

 1 C++ itself is only a description what the language should be,  2 without a definite implementation.  3 Anyone can make his own implementations (compiler etc, runtime library, ...)  4 and call it C++ if it fits to the description.  5 
 6 http://www.open-std.org/jtc1/sc22/wg21/  7 
 8 And if a implementation is open source depends on the creator.  9 
10 Examples of implementation (parts): 11 GCC/G++, libc/libc++, clang (++ too), Visual studio and MS´ runtime...

 

1 C++ is developed by an ISO standard committee. There's also a C++ foundation that runs a web site you might want to read. 2 
3 C++ itself is a language, not a specific implementation, so there's no source code available for the standard/language itself. 4 
5 Some C++ implementations are open source (e.g., Gnu and Clang).

 

1 1. C++ is a code standard defined by the International Organization of Standardization (ISO). There are many different implementations of the language, but they all tend to conform to C++11. Unlike Linux or Qt, C++ is just a standard, and to use any code written in the language you'll need a compiler. The major compilers (list from Wikipedia) are LLVM Clang, GCC, Microsoft Visual C++, and the Intel C++ Compiler. 2 2. C++ revisions are dealt with by ISO, and are influenced primarily by the maintainers of the above four implementations. 3 3. Clang and GCC are both open-source, I'm sure if you poke around you can find other conforming compilers but those are the two most used.

 

  總之,跟Java、Python和PHP這樣所謂的開源語言不同,C語言與C++沒有官方提供的各自確切的實現代碼(庫),ISO/ANSI僅僅提供了C和C++的標准。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM