C++ 中的 main 定义
新的 C++ 标准中 不允许给 main 指定 linkage-specification 了。
当然,考虑到原本 main() 也是 C 运行环境在开始运行程序的时候调用的,而 C 运行环境自然也预期 C linkage,即不按照 C++ 的习惯对符号根据参数增加名字前缀,因此大部分编译器在遇到 C++ 程序定义全局 main() 的时候也会按照习惯采取 C linkage方式去翻译。这一规则首先被 GCC 采纳,随后 LLVM 也跟进了。
共 21 篇文章。
新的 C++ 标准中 不允许给 main 指定 linkage-specification 了。
当然,考虑到原本 main() 也是 C 运行环境在开始运行程序的时候调用的,而 C 运行环境自然也预期 C linkage,即不按照 C++ 的习惯对符号根据参数增加名字前缀,因此大部分编译器在遇到 C++ 程序定义全局 main() 的时候也会按照习惯采取 C linkage方式去翻译。这一规则首先被 GCC 采纳,随后 LLVM 也跟进了。
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.
前一阵子一直无法在 FreeBSD/amd64 上面利用 engimail-thunderbird 来进行 PGP 签名。简单说来,一开始是注册控件的时候 signal 11,留下怪怪的backtrace,到后来索性没反应了。
发信到 engimail 的邮件列表,结果他们也觉得很奇怪。
Alexander Kabaev大长辈今天终于完成了gcc 4.2.1的import,这样,RELENG_7所需的准备工作基本上全面结束。我希望能够在7.0-RELEASE之前把已知的tmpfs问题全部修掉。
今天在改rtld-elf的时候发现,它定义了一个函数指针数组,其内容是参数不定的,于是定义为:
typedef void (*func_ptr)();
然而,在较高的警告级别下,这一写法会被gcc认为不是prototype。
kan 2005-06-03 03:29:21 UTC
FreeBSD src repository
src/contrib/gcc - Imported sources
Update of /home/ncvs/src/contrib/gcc
In directory repoman.freebsd.org:/tmp/cvs-serv9201
Log Message:
Gcc 3.4.4 release.
Status:
Vendor Tag: FSF
Release Tags: gcc_3_4_4_20050518Apparantly des@ has pointed out a serious problem with my patchset, say, the inconsistency of underlying API is the root of evil(tm), and should be corrected.
Let’s go go go!
What is strict aliasing? To make the long thing short, it means that the compiler apply strictest aliasing rules applicable to the language and having these assumptions the optimizer can do further optimizations.
To quote gcc manual:
This is basically equivlent as what is running on beastie.frontfree.net. It exhibits stablity and performance improvements the recent work by FreeBSD folks.
Main new features (all from FreeBSD):
etc.
Yeah I know that you were surprised why there were not delphijfork during the last two weeks, that is because I was extremely busy and beasite got some problems. Now everything seems to be sane.
As title. With Alexenda Kabbev’s import, we now have gcc 3.4.x in the base system. I’ll try to adopt our code ASAP.