C语言是开源的吗?C++是开源的吗?C语言、C++是两个开源的标准,而不是开源软件或其它

摘要:
我一度对于C语言与C++是不是开源语言很困惑:为什么有那么多人鼓吹Java、Python、PHP等是开源语言,却没有人提C与C++开源与否呢?关于C语言开源与否:C语言是一个由ISO组织中的ANSI制定的标准,任何个人或者组织都可以根据这个标准将其实现。现今,世界上有许多不同的C语言实现,比较著名的有:GCC、Watcom、MSC等,其中前两者是开源的,后者是闭源的。出名的C++编译器有:GCC/G++、libc/libc++、clang(++)、Visualstudio和MSruntime等。

我一度对于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++的标准。

免责声明:文章转载自《C语言是开源的吗?C++是开源的吗?C语言、C++是两个开源的标准,而不是开源软件或其它》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇linux 文件描述符Web安全之CSP下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Makefile中用宏定义进行条件编译(gcc -D)/在Makefile中进行宏定义-D

在源代码里面如果这样是定义的:#ifdef MACRONAME//可选代码#endif 那在makefile里面gcc -D MACRONAME=MACRODEF或者gcc -D MACRONAME 这样就定义了预处理宏,编译的时候可选代码就会被编译进去了。 对于GCC编译器,有如下选项:-D macro=string,等价于在头文件中定义:#define...

gcc/g++编译

1. gcc/g++在执行编译工作的时候,总共需要4步 (1).预处理,生成.i的文件[预处理器cpp] (2).汇编,将预处理后的文件转换成汇编语言,生成文件.s[编译器egcs] (3).编译,将汇编语言文件编译为目标代码(机器代码)生成.o的文件[汇编器as] (4).链接,将目标代码,生成可执行程序[链接器ld] [参数详解]   -x lang...

Linux下C语言多文件的编译以及makefile的应用

1.关于编译和链接     一般来说,无论是C、C++,首先要把源文件编译成中间代码文件,在Windows下也就是.obj文件,UNIX下是.o文件,即Object File,这个动作叫做编译(compile)。然后再把大量的Object File合成执行文件,这个动作叫作链接(link)。         也就是源文件(.c 文件或者.cpp文件)首先会...

聊聊音频类开源代码这点事

我工作的头几年是在通信设备商做通信设备上的语音软件开发,主要是follow ITU-T/3GPP/RFC等SPEC写代码,相对封闭,没怎么接触开源代码。后来到芯片公司做终端上的voice engine,开始接触音频类的开源代码,先是ITU-T/3GPP的各种codec,后来是各种完整的解决方案。刚开始做voice engine的时候,GIPS还没被Goog...

评论一下现有几个开源IM框架(Msn/QQ/Fetion/Gtalk...)

转载:http://www.cnblogs.com/zc22/archive/2010/05/30/1747300.html 前言 ---------------- 这阵子,在集成通讯框架, 由于不想自己造轮子,因此参考了现在一些开源的IM框架,结果是。。。。。 让我有点不爽,导致开发的时间不多,但是debug的时间浪费的太多了! 现在让我慢慢...

linux安装python3

--linux安装python3 centos系统本身默认安装有python2.x,可通过python --version 查看系统自带的python版本,有一些系统命令需要用到python2,安装python3时不能卸载python2。 1、安装依赖包                                                   ...