存档

文章标签 ‘lang.c’

ISO C语言标准的更新

2007年11月8日 3 条评论

部分翻译自 ISO C Standard Update

作者Arjun Bijanki是Visual C++编译器的test lead,而且是Microsoft在C标准委员会的代表。

C1x (0<=x<=9)将是下一个版本的C语言标准,ISO国际标准化委员会WG14,C Programming Language刚刚结束了在夏威夷的又一次半年会议,在会上委员会成员讨论了下一版本的C语言,非官方称为C1x的未来发展,参见这里。

对C程序员来说,整部文档都值得一看,但是希望在C1x当中的新的概念引起大家的注意:

12. Trust the programmer, as a goal, is outdated in respect to the security and safety programming communities. While it should not be totally disregarded as a facet of the spirit of C, the C1X version of the C Standard should take into account that programmers need the ability to check their work.
12. 信任程序员,从安全的编程角度上来说已经过时了。虽然说作为C的精神的一个重要方面这个原则并不应该被完全否定,但是C1x有责任给程序员一个检查自己工作的机会。

13. Unlike for C9X, the consensus at the London meeting was that there should be no invention, without exception. Only those features that have a history and are in common use by a commercial implementation should be considered. Also there must be care to standardize these features in a way that would make the Standard and the commercial implementation compatible.
13. 不像C9x,伦敦会议的一致意见是(在C1x当中)完全不应该有任何的新发明。只有经过历史考验和在商业实现当中得到广泛应用的特性才会被考虑。而且在标准化的时候需要注意和商业实现的兼容。

14. Migration of an existing code base is an issue. The ability to mix and match C89, C99, and C1X based code is a feature that should be considered for each proposal.
14. 对已有代码的升级是一个考虑方面。每一个提案都应该具有将基于C89, C99和C1X的代码整合的能力。

代码升级是毋庸置疑的重要 – 我甚至认为这是基本的需求。但是我发现另外两项更有意思。第12条反映了工业界在近10年来对于安全性方面的持续关注,委员会开始拥抱这个设想是非常伟大的。因此委员会在 TR 24731 (边界检查接口,包括了在VS 2005当中大多数_s系列的函数)上面的努力也就也不让人意外了。

委员会也要求编译器厂商提供它们被最广泛应用的语言扩展以便委员会考虑。在众多实现(例如Visual C++ 和 GCC)当中共享的很多特性,像扩展属性(extended attributes)和线程局部存储(thread local storage),将被重点考察。还有一些情况,实现之前语法可能有区别,但是底层的概念是一致的。正如 #13所说,委员会会尽力去对他们保持兼容。

对于微软为什么没有在Visual C++当中完整的实现C99,Arjun Bijanki的解释是实现哪些功能是基于用户提出的需求的。根据用户的需求,Visual C++已经实现了可变长参数宏(variadic macros),long long类型,__pragma, __FUNCTION__, 和__restrict。他希望能够听到更多来自C语言用户的需求,而且许诺会在明年4月份的下一次会议后给出关于C标准更进一步的更新。

标签: ,