为什么FreeBSD没有CIRCLEQ_*
最近在看Berkeley DB,发现一套FreeBSD上没有的宏,CIRCLEQ_*。
看了一下,这组宏是来自4.4BSD的,因此FreeBSD曾经有过这个宏;后来,phk在2000年12月29日从FreeBSD里面把它拿掉了(SVN revision 70469),当时的说明如下:
共370篇文章。
最近在看Berkeley DB,发现一套FreeBSD上没有的宏,CIRCLEQ_*。
看了一下,这组宏是来自4.4BSD的,因此FreeBSD曾经有过这个宏;后来,phk在2000年12月29日从FreeBSD里面把它拿掉了(SVN revision 70469),当时的说明如下:
其实是个很简单的常识,居然搞了我半个小时……
fgetc()的返回值是int,因为这个值除了返回拿到的字符之外,还兼作错误标志。由于fgetc()允许文件中包含任意内容,所以只好增大返回值的宽度来表达。
WxClassInfo的析构函数(~WxClassInfo)死循环是什么原因?检查发现RTTI的那个链表有个环,但是不太明白这个表(从上下文看是由Register()方法维护的)为什么能出现环?
Pretty interesting project: Haiku.
It looks like that it uses a lot of FreeBSD code by creating glue between FreeBSD and BeOS API, on the other hand they are using MIT license for most of their code, making sharing code easy.
I have taken some time to rewrite memchr(3) to utilize a similar
algorithm to my strlen(3). Two different formulas, however, would
have roughly a 1/3 difference.
Currently I have taken an approach where, when memchr(3) tries to
match an 8-bit pattern, it treats the string as 8-bit using the first
formula, which is expected to have uniform time complexity by
reducing unnecessary branches.
This approach, however, might be bogus: if you look for a 7-bit
character within an 8-bit string, memchr(3) will perform poorly when
there are many characters with their MSB set to 1.
今年1月27日发表的《GCC运行环境豁免条款 (英文版)》再次狠狠地打了苹果的耳光。
原先的豁免条款如下:
// As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License.
As some of you already know, FreeBSD, along with some other Open Source projects, is moving away from GCC due to GPLv3. From a technology perspective, this also makes sense since the (likely) candidate, BSD-style licensed, LLVM based clang, a C compiler, is making reasonably good progress.
So, what should we expect from LLVM or clang?
Here is a good comparison between GCC and clang. Despite GCC is popular, considerably more mature,and supports more languages (especially C++, which clang’s support is incomplete at this moment), clang provides cleaner AST (Abstract Syntax Tree), much more modularized (if you take a look at GCC’s history,Richard Stallman intentionally made GCC’s code not reusable in other software), provided much more information for optimizer, is much faster and use much less memory, etc.
For FreeBSD, currently, clang can compile its kernel with only very few tweaks.
Finally, I got my strlen(3) [1] committed against -HEAD. This is a long story, to put it short, I had proposed assembly version of some string operations at the point of 2005, but these was never committed due to a hard disk failure, and as Bruce pointed out, having the hand optimized assembly code use a different algorithm is not good in general.
Therefore, I have take some time on it and reimplemented the idea in C,resulting in a portable (say, you can use it on any 32-bit or 64-bit processors, and it can be easily extended to 128-bit) version.
So, is it important for *YOU*?
Generally speaking, it should not. Performance sensitive programs should, by all means, avoid C style string operations. Think a 5x better strlen(3) would boost performance of your application since it uses strlen(3) in critical path? Think again!
However, I found it valuable. There is difference in worldstone, where I saw some minor improvements. Micro-benchmark indicates that this version is at most 2x slower when the string is very short, but 5x faster for strings that is at least word-length long.
[1] Note: the version has been further revised to provide better comment and match style(9).
许多老派的FreeBSD用户喜欢用源代码方式升级。运行了十多年的基于cvsup的同步机制由于有很多镜像支持因此一直没有遇到太大的问题,但是FreeBSD 6.1开始引入