<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GNU | 酷 壳 - CoolShell</title>
	<atom:link href="https://coolshell.cn/tag/gnu/feed" rel="self" type="application/rss+xml" />
	<link>https://coolshell.cn</link>
	<description>享受编程和技术所带来的快乐 - Coding Your Ambition</description>
	<lastBuildDate>Mon, 20 Aug 2012 02:06:21 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2</generator>
	<item>
		<title>GCC 用 C++ 来编译</title>
		<link>https://coolshell.cn/articles/8115.html</link>
					<comments>https://coolshell.cn/articles/8115.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Mon, 20 Aug 2012 00:40:04 +0000</pubDate>
				<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[编程工具]]></category>
		<category><![CDATA[bootstrapping]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[GNU]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=8115</guid>

					<description><![CDATA[<p>GCC在2012年8月15日的时候，merge了一个patch &#8211; Merge from cxx-conversion branch，这意味着，以后...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/8115.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/8115.html">GCC 用 C++ 来编译</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>GCC在2012年8月15日的时候，merge了一个patch &#8211; <a href="http://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=2b15d2ba7eb3a25dfb15a7300f4ee7a141ee8539" target="_blank">Merge from cxx-conversion branch</a>，这意味着，以后在GCC的编译只能用C++的编译器了，也意味着，gcc的实现代码开始转向C++了。</p>
<p>你可能会有两个问题，</p>
<ul>
<li>一个问题是为什么GCC要转成C++的实现？</li>
</ul>
<ul>
<li>没有C++的编译器，我怎么编译C++编译器的代码？这不是“鸡生蛋还是蛋生鸡”的问题么？</li>
</ul>
<p>那，我们来看一看吧。</p>
<h4>为什么要用C++</h4>
<p>在<a href="http://gcc.gnu.org/wiki/cxx-conversion" target="_blank">GNU的C++ Conversion文档</a>中，我们可以在Background中看到这样的描述：</p>
<blockquote><p>Whether we use C or C++, we need to try to ensure that interfaces are easy to understand, that the code is reasonably modular, that the internal documentation corresponds to the code, that it is possible for new developers to write new passes and to fix bugs. Those are the important issues for us to consider. The C++ features which are not present in C &#8212; features which are well documented in many books and many web sites &#8212; are not an important issue.</p></blockquote>
<p>这句话的意思可以理解为，今天GCC在用C语言的实现已经有点hold不住了，因为，开发人员觉得，不管我们用C或C++，都需要努力确保接口是容易理解的，这样我们的代码是想当理性地被模块化的，这样内部文档和代码一致，这样可以更好地组织代码，这样有利于新人了fix-bug。而C++正好可以让他们更好的完成这些东西。</p>
<p>GNU还给出了下面这些理由：</p>
<p><span id="more-8115"></span></p>
<ul>
<li>C++ 是一种标准化的，大众的，流行的语言。</li>
<li>C++ 是C90的超集。</li>
<li>C++作为C的扩展和C在性能上一样好。</li>
<li>C++ 在一些有意义的案例上支持更干净的代码。</li>
<li>C++ 让你更容易去写一个更干净的接口。</li>
<li>C++ 永远不会让你的代码变得更丑。</li>
<li>C++ 不是万灵药，他是C的一个改进。</li>
</ul>
<p>然后，给了一个PDF <a href="http://airs.com/ian/cxx-slides.pdf">http://airs.com/ian/cxx-slides.pdf</a>，这是Google 的<a href="http://airs.com/ian/" target="_blank"> Ian Lance Taylor</a>的的一个PPT，这个文档可以让大家更好地理解我在《<a title="C++的坑真的多吗？" href="https://coolshell.cn/articles/7992.html" target="_blank">C++的坑多吗？</a>》一文中那些观点。<strong>我都不知道我要说多少遍C++的封装，继承和多态比C语言在代码组织上要好得多得多</strong>。大家还是自己看一下代码吧：</p>
<p><strong><span style="color: #800000;">数据结构的操作</span> —— </strong>你写的一定不会有STL好</p>
<p style="padding-left: 30px;"><strong><a href="https://coolshell.cn/wp-content/uploads/2012/08/VEC-vs-vector.jpg"><img decoding="async" loading="lazy" class="size-full wp-image-8119 alignnone" title="VEC vs vector" src="https://coolshell.cn/wp-content/uploads/2012/08/VEC-vs-vector.jpg" alt="" width="542" height="343" srcset="https://coolshell.cn/wp-content/uploads/2012/08/VEC-vs-vector.jpg 542w, https://coolshell.cn/wp-content/uploads/2012/08/VEC-vs-vector-300x190.jpg 300w, https://coolshell.cn/wp-content/uploads/2012/08/VEC-vs-vector-427x270.jpg 427w" sizes="(max-width: 542px) 100vw, 542px" /></a></strong></p>
<p><span style="color: #800000;"><strong>结构套结构还是继承？</strong></span></p>
<p style="padding-left: 30px;"><a href="https://coolshell.cn/wp-content/uploads/2012/08/tree-structure.jpg"><img decoding="async" loading="lazy" class=" wp-image-8118 alignnone" title="tree-structure" src="https://coolshell.cn/wp-content/uploads/2012/08/tree-structure.jpg" alt="" width="629" height="550" srcset="https://coolshell.cn/wp-content/uploads/2012/08/tree-structure.jpg 699w, https://coolshell.cn/wp-content/uploads/2012/08/tree-structure-300x262.jpg 300w" sizes="(max-width: 629px) 100vw, 629px" /></a></p>
<p><span style="color: #800000;"><strong>函数指针还是多态？</strong></span></p>
<div style="padding-left: 30px;"><a href="https://coolshell.cn/wp-content/uploads/2012/08/TARGET-vs-Target.jpg"><img decoding="async" loading="lazy" class=" wp-image-8117 alignnone" title="TARGET vs Target" src="https://coolshell.cn/wp-content/uploads/2012/08/TARGET-vs-Target.jpg" alt="" width="391" height="470" srcset="https://coolshell.cn/wp-content/uploads/2012/08/TARGET-vs-Target.jpg 489w, https://coolshell.cn/wp-content/uploads/2012/08/TARGET-vs-Target-249x300.jpg 249w" sizes="(max-width: 391px) 100vw, 391px" /></a></div>
<p><span style="color: #800000;"><strong>垃圾回收 还是 智能指针？</strong></span></p>
<div style="padding-left: 30px;"><a href="https://coolshell.cn/wp-content/uploads/2012/08/GC-vs-Smart-Pointer.jpg"><img decoding="async" loading="lazy" class="wp-image-8116 alignnone" title="GC vs Smart Pointer" src="https://coolshell.cn/wp-content/uploads/2012/08/GC-vs-Smart-Pointer.jpg" alt="" width="473" height="337" srcset="https://coolshell.cn/wp-content/uploads/2012/08/GC-vs-Smart-Pointer.jpg 676w, https://coolshell.cn/wp-content/uploads/2012/08/GC-vs-Smart-Pointer-300x213.jpg 300w" sizes="(max-width: 473px) 100vw, 473px" /></a></div>
<p><span style="color: #800000;"><strong>Why not C++? </strong></span></p>
<ul>
<li><strong>C++慢吗</strong>？某些特性会慢，但是有时C++更快，你可以只用你喜欢的C++特性。</li>
<li><strong>C++复杂吗？</strong>它只不过是另一种编程语言，他可以让你对程序员维护更简单。</li>
<li><strong>FSF不喜欢C++！</strong>因为FSF（自由软件基金会）这些人不写代码。</li>
</ul>
<p><a href="https://coolshell.cn/wp-content/uploads/2012/08/Why-not-C++.jpg"><img decoding="async" loading="lazy" class="aligncenter  wp-image-8120" title="Why not C++" src="https://coolshell.cn/wp-content/uploads/2012/08/Why-not-C++.jpg" alt="" width="478" height="418" srcset="https://coolshell.cn/wp-content/uploads/2012/08/Why-not-C++.jpg 683w, https://coolshell.cn/wp-content/uploads/2012/08/Why-not-C++-300x262.jpg 300w" sizes="(max-width: 478px) 100vw, 478px" /></a></p>
<div></div>
<h4>Bootstrapping</h4>
<p>最后，我想来介绍一下<a href="http://en.wikipedia.org/wiki/Bootstrapping_%28compilers%29" target="_blank">Bootstrapping</a>。 所谓Bootstrapping，就是用自己这个语言写编译器来编译自己，也就是说如果你要编译gcc，你需要用一个c的编译器来编译之，这个就是bootstrapped process，自举过程。包括 <a title="BASIC" href="http://en.wikipedia.org/wiki/BASIC">BASIC</a>, <a title="Algol" href="http://en.wikipedia.org/wiki/Algol">Algol</a>, <a title="C (programming language)" href="http://en.wikipedia.org/wiki/C_(programming_language)">C</a>, <a title="C++" href="http://en.wikipedia.org/wiki/C%2B%2B">C++</a>, <a title="Pascal programming language" href="http://en.wikipedia.org/wiki/Pascal_programming_language">Pascal</a>, <a title="PL/I" href="http://en.wikipedia.org/wiki/PL/I">PL/I</a>, <a title="Factor programming language" href="http://en.wikipedia.org/wiki/Factor_programming_language">Factor</a>, <a title="Haskell (programming language)" href="http://en.wikipedia.org/wiki/Haskell_(programming_language)">Haskell</a>, <a title="Modula-2" href="http://en.wikipedia.org/wiki/Modula-2">Modula-2</a>, <a title="Oberon programming language" href="http://en.wikipedia.org/wiki/Oberon_programming_language">Oberon</a>, <a title="OCaml" href="http://en.wikipedia.org/wiki/OCaml">OCaml</a>,<a title="Common Lisp" href="http://en.wikipedia.org/wiki/Common_Lisp">Common Lisp</a>, <a title="Scheme (programming language)" href="http://en.wikipedia.org/wiki/Scheme_(programming_language)">Scheme</a>, <a title="Java (programming language)" href="http://en.wikipedia.org/wiki/Java_(programming_language)">Java</a>, <a title="Python (programming language)" href="http://en.wikipedia.org/wiki/Python_(programming_language)">Python</a>, <a title="Scala (programming language)" href="http://en.wikipedia.org/wiki/Scala_(programming_language)">Scala</a> 等语言都这么干。</p>
<p>这样干的好处主要是，自己可以测试自己，编译器的改善和语言的改善相辅相成。</p>
<p>但是，这是一个“鸡生蛋，还是蛋生鸡”的问题，如果你需要用X语言来写一个X语言编译器的语言，你可以这样干：</p>
<ul>
<li>用Y语言来实现X的语言解释器或编译器。 <a title="Niklaus Wirth" href="http://en.wikipedia.org/wiki/Niklaus_Wirth">Niklaus Wirth</a> 说 <a title="Pascal programming language" href="http://en.wikipedia.org/wiki/Pascal_programming_language">Pascal</a> 的第一个编译器是由 <a title="Fortran" href="http://en.wikipedia.org/wiki/Fortran">Fortran</a> 写的。</li>
<li>已存在用Y语言写的X语言的编译器或解释器。<a title="Scheme (programming language)" href="http://en.wikipedia.org/wiki/Scheme_(programming_language)">Scheme</a> 就是这么干的。</li>
<li>已经有一个编译器来编译一个早期版本的X语言，然后就可以用早期版本的X语言来编译新版本的X语言了。<a title="Java (programming language)" href="http://en.wikipedia.org/wiki/Java_(programming_language)">Java</a>，<a title="Haskell (programming language)" href="http://en.wikipedia.org/wiki/Haskell_(programming_language)">Haskell</a>, 和最初版的 <a title="Free Pascal" href="http://en.wikipedia.org/wiki/Free_Pascal">Free Pascal</a> 就是这么干的。</li>
<li>X在某平台上的编译器已经存在，可以使用交叉编译技术来编译另一个平台上X语言，C语言就是这么干的。</li>
<li>用X语言写一个编译器，然后手动编译之（不需要特别优化），（注：手动编译估计就是手动翻译成机器汇编代码），然后再运行这个手动编译的编译器来编译这个编译器的源码，并优化之。<a title="Donald Knuth" href="http://en.wikipedia.org/wiki/Donald_Knuth">Donald Knuth</a> 在他的 <a title="WEB" href="http://en.wikipedia.org/wiki/WEB">WEB</a> <a title="Literate programming" href="http://en.wikipedia.org/wiki/Literate_programming">literate programming</a> 系统里用到了这个方法。</li>
</ul>
<p>（全文完）<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" id="wp_rp_first"><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/7886.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/07/muxnt-150x150.jpg" alt="代码执行的效率" width="150" height="150" /></a><a href="https://coolshell.cn/articles/7886.html" class="wp_rp_title">代码执行的效率</a></li><li ><a href="https://coolshell.cn/articles/20845.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2020/03/rust-social-wide-150x150.jpg" alt="Rust语言的编程范式" width="150" height="150" /></a><a href="https://coolshell.cn/articles/20845.html" class="wp_rp_title">Rust语言的编程范式</a></li><li ><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2018/05/300x262-150x150.jpg" alt="程序员练级攻略（2018)  与我的专栏" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_title">程序员练级攻略（2018)  与我的专栏</a></li><li ><a href="https://coolshell.cn/articles/18024.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/07/api-design-300x278-2-150x150.jpg" alt="API设计原则 &#8211; Qt官网的设计实践总结" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18024.html" class="wp_rp_title">API设计原则 &#8211; Qt官网的设计实践总结</a></li><li ><a href="https://coolshell.cn/articles/12052.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/29.jpg" alt="Leetcode 编程训练" width="150" height="150" /></a><a href="https://coolshell.cn/articles/12052.html" class="wp_rp_title">Leetcode 编程训练</a></li><li ><a href="https://coolshell.cn/articles/12012.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2014/10/edsm-150x150.gif" alt="State Threads 回调终结者" width="150" height="150" /></a><a href="https://coolshell.cn/articles/12012.html" class="wp_rp_title">State Threads 回调终结者</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/8115.html">GCC 用 C++ 来编译</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/8115.html/feed</wfw:commentRss>
			<slash:comments>41</slash:comments>
		
		
			</item>
		<item>
		<title>GNU/Linux下有多少是GNU的？</title>
		<link>https://coolshell.cn/articles/4826.html</link>
					<comments>https://coolshell.cn/articles/4826.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Mon, 13 Jun 2011 00:25:42 +0000</pubDate>
				<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[操作系统]]></category>
		<category><![CDATA[GNU]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=4826</guid>

					<description><![CDATA[<p>一个葡萄牙的学生写了一篇文章 《How much GNU is there in GNU/Linux?》 &#8211; GNU/Linux下有多少是GNU的。...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/4826.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/4826.html">GNU/Linux下有多少是GNU的？</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>一个葡萄牙的学生写了一篇文章 《<a href="http://pedrocr.net/text/how-much-gnu-in-gnu-linux" target="_blank">How much GNU is there in GNU/Linux?</a>》 &#8211; GNU/Linux下有多少是GNU的。他的这篇文章主要分布了今年4月份的Ubuntu Natty的Linux分发包。其主要是用代码行来做的分析，其给了两个饼图。</p>
<p>第一个饼图如下，其指明了各种主流的开源项目组的分布情况。可见GNU只占了8%，当然，GNome也是GNU的，加起来也只有13%，只占整个分发包很少的比重。</p>
<p><img decoding="async" class="aligncenter" src="http://pedrocr.net/images/GNUTotalSplit.png" alt="" /></p>
<p>第二个图，作者把GNU的部分拿了出来，再进行了分析：</p>
<p><span id="more-4826"></span></p>
<p>在下面这个图中，我们可以看到主要是四大块——gcc, gdb, binutils 和 glibc，所以，作者说，这些东西都不是最终用户需要的，不是每一个用户都是需要搞开发的。所以，如果去除这些，再去除Gnome（这个桌面UI也不是很力），那么GNU的东西几乎没有了。</p>
<p><img decoding="async" class="aligncenter" src="http://pedrocr.net/images/GNUSplit.png" alt="" /></p>
<p>所以，作者以此来挑战Richard Stallman提到的 GNU/Linux的这个说法。好像更为好的说法应该叫——</p>
<p style="text-align: center;"><strong>GNU/KDE/java/xorg/Linux</strong></p>
<p>我对这篇文章有下述一些感觉：</p>
<ul>
<li>以代码行来衡量重要性，非常的不准确。比尔盖茨说过——“用代码行数来衡量编程的进度，就如同用航空器零件的重量来衡量航空飞机的制造进度一样”（参看《<a title="最佳编程语录" href="https://coolshell.cn/articles/2753.html" target="_blank">最佳编程语录</a>》），所以，用这个数据来并不一定正确。如果用Linux的各种包的依赖性可能会更好一点。</li>
<li>至少我知道，离开了glibc，可能整个操作系统都会不举。Linux下，绝大多数软件都是gcc/gdb编程和调试出来的（当然，LLVM和Clang正在挑战着gcc编译器），而且大多数软件都在用着GPL的许可证（<a title="狗日的开源软件许可证" href="https://coolshell.cn/articles/4657.html" target="_blank">虽然开源世界的许可证是如此的混乱</a>）</li>
<li>辩证地，我们不能否定GNU的历史价值，同时我们似乎也在看到GNU好像有点萎靡。</li>
</ul>
<p>老实说，其实叫什么不重要，是GNU/Linux也好，是Ubuntu 也好，还是Android也好，无所谓。Linux的各种分发包中都存在着全世界黑客文化的和开源文化的结晶，每当我看到这样的分布图时（例如：<a title="谁写了Linux" href="https://coolshell.cn/articles/1360.html" target="_blank">是谁写的Linux?</a>），我心中都有一种说不出来的豪情，这难道不真是一种壮举吗？（<a title="Unix传奇(上篇)" href="https://coolshell.cn/articles/2322.html" target="_blank">Unix黑客文化的真正延伸</a>）。</p>
<p>不管这种方式的软件有没有市场，能不能得到“最终用户”的认可，但这已成为了软件开发的一种精神——那种不分彼此，相互协作的精神，不是吗？</p>
<p>（全文完）<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/1097.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/24.jpg" alt="Ksplice Uptrack — Ubuntu更新不用重启" width="150" height="150" /></a><a href="https://coolshell.cn/articles/1097.html" class="wp_rp_title">Ksplice Uptrack — Ubuntu更新不用重启</a></li><li ><a href="https://coolshell.cn/articles/501.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/30.jpg" alt="Ubuntu的并行启动" width="150" height="150" /></a><a href="https://coolshell.cn/articles/501.html" class="wp_rp_title">Ubuntu的并行启动</a></li><li ><a href="https://coolshell.cn/articles/22320.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2022/12/eBPF-150x150.jpeg" alt="eBPF 介绍" width="150" height="150" /></a><a href="https://coolshell.cn/articles/22320.html" class="wp_rp_title">eBPF 介绍</a></li><li ><a href="https://coolshell.cn/articles/19219.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2019/03/linux.ninja_-150x150.png" alt="打造高效的工作环境 &#8211; Shell 篇" width="150" height="150" /></a><a href="https://coolshell.cn/articles/19219.html" class="wp_rp_title">打造高效的工作环境 &#8211; Shell 篇</a></li><li ><a href="https://coolshell.cn/articles/18654.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2018/12/docker-networking-1-150x150.png" alt="记一次Kubernetes/Docker网络排障" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18654.html" class="wp_rp_title">记一次Kubernetes/Docker网络排障</a></li><li ><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2018/05/300x262-150x150.jpg" alt="程序员练级攻略（2018)  与我的专栏" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_title">程序员练级攻略（2018)  与我的专栏</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/4826.html">GNU/Linux下有多少是GNU的？</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/4826.html/feed</wfw:commentRss>
			<slash:comments>38</slash:comments>
		
		
			</item>
		<item>
		<title>狗日的开源软件许可证</title>
		<link>https://coolshell.cn/articles/4657.html</link>
					<comments>https://coolshell.cn/articles/4657.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Wed, 04 May 2011 00:25:17 +0000</pubDate>
				<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[编程工具]]></category>
		<category><![CDATA[轶事趣闻]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[DBAD]]></category>
		<category><![CDATA[GNU]]></category>
		<category><![CDATA[GPL]]></category>
		<category><![CDATA[MIT]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[WTFPL]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=4657</guid>

					<description><![CDATA[<p>你知道这个世上有多少种开源软件的许可证吗？GPL，BSD，MIT，Apache？GNU上有个网页，上面记录了几乎所有的开源软件的许可证，真TMD的多，有开源的，...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/4657.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/4657.html">狗日的开源软件许可证</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>你知道这个世上有多少种开源软件的许可证吗？GPL，BSD，MIT，Apache？GNU上有个网页，上面<a href="http://www.gnu.org/licenses/license-list.html" target="_blank">记录了几乎所有的开源软件的许可证</a>，真TMD的多，有开源的，有商用的，有软件的，有文档的，多得你都不想看了，天杀的，程序员们还真能鼓捣啊。不过，主流的也就几种——<a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GPL</a><a href="https://coolshell.cn/wp-content/uploads/2011/05/OSS-License.jpg"></a>、<a href="http://en.wikipedia.org/wiki/BSD_licenses">BSD</a>、<a href="http://en.wikipedia.org/wiki/MIT_License">MIT</a>、<a href="http://www.mozilla.org/MPL/">Mozilla</a>、<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache</a>等等。</p>
<p>那么，你知道怎么区别他们吧？怎么选择他们吗？这里有一张比较复杂的图，在调侃这些纷繁的许可证（我不翻译了，这个图属于是发泄不满）</p>
<p style="text-align: center;"><a href="https://coolshell.cn/wp-content/uploads/2011/05/OSS-License.jpg"><img decoding="async" loading="lazy" title="OSS License" src="https://coolshell.cn/wp-content/uploads/2011/05/OSS-License.jpg" alt="" width="567" height="730" /></a></p>
<p>下面是另一个图，这个图<a href="http://pbagwl.com/post/5078147450/description-of-popular-software-licenses" target="_blank">来自这里</a><a href="https://coolshell.cn/wp-content/uploads/2011/05/Infographic-of-popular-software-licenses.jpg"></a>，这个图并不恶搞，但其非常简单地说明了如何选择一个开源的许可证：</p>
<p><span id="more-4657"></span></p>
<p style="text-align: center;"><a href="https://coolshell.cn/wp-content/uploads/2011/05/Infographic-of-popular-software-licenses.jpg"><img decoding="async" loading="lazy" title="Infographic of popular software licenses" src="https://coolshell.cn/wp-content/uploads/2011/05/Infographic-of-popular-software-licenses.jpg" alt="" width="560" height="446" /></a></p>
<p style="text-align: left;">最后，正如<a title="BT雷人的程序语言（大全）" href="https://coolshell.cn/articles/4458.html" target="_blank">那些BT雷人的程序语言</a>一样，我想介绍两个比较独特的开源软件许可证给你，以辉映本文的标题——</p>
<h4 style="text-align: left;">1、WTFPL</h4>
<p style="text-align: left;"><a href="http://sam.zoy.org/wtfpl/COPYING" target="_blank">WTFPL</a>全称 What The Fuck Public License，这个许可证单从名字上就那么NB了，其许可证如下，相当的短，完全的自由，你的开源软件有自信用这个许可证吗？</p>
<pre>            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

 Copyright (C) 2004 Sam Hocevar &lt;sam@hocevar.net&gt;

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE FUCK YOU WANT TO.</pre>
<p style="text-align: left;">最后那句——You just DO WHAT THE FUCK YOU WANT TO 真是铿锵有力，怎么说怎么痛快，很有一种在看美国大片的感觉。这是我喜欢这个许可证的原因之一，即不限制你控制版权，也不限制你放弃版权！</p>
<h4 style="text-align: left;">2、DBAD</h4>
<p style="text-align: left;"><a href="https://github.com/SFEley/candy/blob/2f964916961a2dcccbb374cd389520ac2ac62226/LICENSE.markdown" target="_blank">DBAD</a>全称 Don&#8217;t Be A Dick，dick是什么我就不解释了，你自己查字典吧。这个许可证中定义了什么是dick，</p>
<blockquote>
<p style="text-align: left;">A person who <em>does not</em> respect the time and energy that have been invested in the Project, ……. A Dick is nearly always selfish, but not necessarily with deliberate intent; some Dicks are merely thoughtless. ……</p>
</blockquote>
<p style="text-align: left;">也就是项目中扯淡的人。这个许可证最NB的地方在于其不限制软件的版权，而是限制了软件开发中的人的行为。我真是太喜欢这个许可证了。（请参看其第四节Limitation ）</p>
<p style="text-align: left;">（全文完）</p>
<p><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/3723.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/17.jpg" alt="（麻省理工免费课程）计算机科学和编程导论" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3723.html" class="wp_rp_title">（麻省理工免费课程）计算机科学和编程导论</a></li><li ><a href="https://coolshell.cn/articles/19996.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2019/11/ken.dennis-300x186-1-150x150.jpeg" alt="Unix 50 年：Ken Thompson 的密码" width="150" height="150" /></a><a href="https://coolshell.cn/articles/19996.html" class="wp_rp_title">Unix 50 年：Ken Thompson 的密码</a></li><li ><a href="https://coolshell.cn/articles/19612.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2019/07/1920px-Margaret_Hamilton_-_restoration-e1563697198766-1-150x150.jpg" alt="50年前的登月程序和程序员有多硬核" width="150" height="150" /></a><a href="https://coolshell.cn/articles/19612.html" class="wp_rp_title">50年前的登月程序和程序员有多硬核</a></li><li ><a href="https://coolshell.cn/articles/17929.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/06/go-hardhat-150x150.png" alt="Go编程模式：修饰器" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17929.html" class="wp_rp_title">Go编程模式：修饰器</a></li><li ><a href="https://coolshell.cn/articles/17757.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/04/IMG_7411-150x150.jpg" alt="如何重构“箭头型”代码" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17757.html" class="wp_rp_title">如何重构“箭头型”代码</a></li><li ><a href="https://coolshell.cn/articles/12052.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/29.jpg" alt="Leetcode 编程训练" width="150" height="150" /></a><a href="https://coolshell.cn/articles/12052.html" class="wp_rp_title">Leetcode 编程训练</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/4657.html">狗日的开源软件许可证</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/4657.html/feed</wfw:commentRss>
			<slash:comments>23</slash:comments>
		
		
			</item>
	</channel>
</rss>
