来自标准委员会的坏消息 :(

longshanks 2007-10-31 09:50:58
昨天,C++标准委员会网站发布了最近一次会议的papers。当我兴致勃勃地翻阅State of C++ Evolution时,当即发现一个坏消息:gc可能无法赶在09年之前进入标准!
gc被归入了:
Not quite ready for C++0x timetable, but actively pursued
Papers in this category have been in development and reviewed several times over the evolution of C++0x. However, although there is a strong interest the feature has not quite stabilised fast enough to meet the 2009 target deadline. Work will proceed outside the main committee meetings, and will be picked up with a view to an early adoption.
N1833 N1943 N2128 N2129 N2286 N2287 N2310 Transparent Garbage Collection for C++ H. Boehm, M. Spertus
N2261 Optimization-robust finalization H. J. Boehm, M. Spertus
最后一句话多少给人些安慰。

在文档Minutes of WG21 Meeting中,可以看到,当时他们将gc列为inessential,并且表决通过,暂不讨论这些内容:
Nelson observed that the discussion was preoccupied with the question of which proposals are essential. He requested some discussion to identify those proposals that are inessential, noting that GC, Lambdas, and thread pools had not been identified in the discussion as essential.
Stroustrup indicated that he would be willing to leave out thread pools and GC to complete the standard in 2009. He declined to make the same comment about Lambdas until the EWG had time to review the latest draft of that proposal at this meeting.
Hinnant asked about whether threadpools, in the context of this discussion, included futures. Sutter explained that he believes that they mean everything beyond a basic threading API.
Austern speculated that a simple threadpool that is not associated with futures could pass quickly. Stroustrup agreed.
Discussion ensued.
Sutter asked how many members in attendance were willing to stop talking about GC, threadpools, read/write locks, message queues, and futures for the sake of meeting the schedule. Dos Reis replied that France would like to have a form of programmer-controlled GC in C++, and that a simplification of the current proposal would be satisfactory.
Meredith reported that the UK position on GC is that they would rather have standard without GC than a late standard
J16 voting members in favor of stopping talk about GC and advanced threading
WG favor oppose abstain
J16 lots 1 3
WG21 3 2 0
同时也可以看到,lambda也差点被列为inessential。不过从最后的清单来看,这个对普通程序员非常重要的特性依然保留在Blessed by evolution - wording available for initial review by Core一栏内。但是似乎命悬一线。

另外两个最关键的特性concept和concurrency被保住了:
Stroustrup expressed the feeling that shipping something without threads and without concepts will damage our reputation.
不过,concept化的库进展不好:
Meredith remarked that the LWG has made little progress with respect to conceptualizing the standard library, because many of the experts on concepts are working in CWG, and that there must be at least one meeting after CWG is done with concepts to complete the necessary LWG meeting.
好在后来英国人帮了大忙:
Glassborow reported the UK would vote no to a standard that had concepts in the core language but not in the library.

另一个坏消息是Initializer lists上次已经进入草案文本,但由于一些问题,又被撤了出来:
4) WG21/D2441=J16/07-0311, "Initializer lists WP wording (Revision 1)" held back because of

* Question about definition of narrowing conversion restrictions for float literals.
* Jason Merrill wants a shot at tweaking the overload resolution rules.
* Jaakko Jarvi, on the core reflector, pointed out that it might be surprising that template deduction might produce an initializer_list<X> parameter for a function template that doesn't expect one.
* It was pointed out that explicit constructors unfortunately get used implicitly in some sense to make objects out of raw {x, y, z} lists in calls.
Bjarne recounted a discussion in which the EWG found a solution to the narrow conversion problem, but he reported that the other problems "go fairly deep into the design of the proposal."


此外,便是一些鸡毛蒜皮的事情了。下一次会议在明年2月24-29,在Bellvue, WA召开。可能会通过concept和大部分的concurrency提案。希望他们别再弄出什么坏消息了。
...全文
962 52 打赏 收藏 转发到动态 举报
写回复
用AI写文章
52 条回复
切换为时间正序
请发表友善的回复…
发表回复
redex 2007-11-03
  • 打赏
  • 举报
回复
"诸位:
我忍不住想说一些我对C++ gc的看法。
... ..."

---楼主概括的不错, 我只知道大约在3,4年前, cpp大师们就在热论这个问题了, 经楼主这么
概括一说, 有利于加深理解, 不错.
longshanks 2007-11-03
  • 打赏
  • 举报
回复
to benjiam:
这个帖子中,我给出了一篇由美国空军写的论文,其中比较了ada、C++、C等语言的使用成本、错误率等软件工程方面的数据,从这些数据上,就能看出,为什么会有C++这种语言了。
longshanks 2007-11-03
  • 打赏
  • 举报
回复
诸位:
我忍不住想说一些我对C++ gc的看法。
请注意,C++0x的gc是可选的,并且有多种选择,包括全手动、半自动、全自动等诸多选择。详见这篇blog
一边情况下,我认为我们还是能够从gc中得到很多帮助的。我觉得这里存在gc使用上的一些误区。首先,gc并不慢,满是慢在不合理的gc。java、C#等语言,几乎任何类型都需要gc,这是不合理的。大多数对象可以存在于栈中,可以准确、自动地释放。通过raii可以确保更好的资源管理。比如,我在一个函数中使用了一个字符串,函数推出时,字符串也就没用了,可以主动地归还系统。但在java等中,这些都强制性地通过gc回收。这么多鸡零狗碎的东西都gc,不慢才怪。
而C++0x的gc有本质的区别。默认情况下,gc会忽略手动的内存管理。你想new就new,想delete就delete。对于那些new了没有delete的内存,才动用gc。这种情况下,gc可以作为一种补充,或者说补漏。是我们软件开发的定心丸。反而可以促使我们更放心地使用new/delete。
另外,我觉得,即使有了gc,C++程序员也不应盲目使用。对于可以在栈里分配的对象(局部对象),或者对象的子对象(成员对象),完全不需要通过gc(new)。直接定义对象即可,方便快捷。只有那些必须在堆上分配的对象,才需要new。如果程序员能够掌控new/delete操作,那么手工做也是很好的选择。(但请注意,这不利于异常安全)。如果不愿手工,那么gc也是个不错的选择。
总之,一句话,并不是gc不好,而是java(C#等)的gc不好。大家还是接受它吧,在C++中,gc是你的好助手,而不是你的主人。
longshanks 2007-11-03
  • 打赏
  • 举报
回复
to Waiting4you:
不必客气。:)。还有一些需要说明一下。
智能指针属于raii的一种应用,用于管理内存。raii还可以用于文件、网络套接字、锁等各类资源。对于很多珍贵的资源,raii是用完即释放,相比gc更好。而且raii还有许多其他应用,比如可用于保持commit or rollback语义,详见《imperfect C++》。
concurency在很大程度上必须得到编译器的支持。时间已经证明,仅仅依靠库是无法得到完善的concurency的。由于C++98/03中没有考虑任何线程问题,以至于允许编译器实行破坏并发正确性的优化措施。这一点,C++已经到了不能不改的地步了。
boost::concept仅实现concept的模板参数的约束功能。C++0x的concept则提供了更强大的功能。当concept同特化相结合之后,会使泛型编程变得更加自然方便。详细情况请看这个帖子中65、67、68、71楼中我给出的例子。其他方面,看我给出的那个blog链接。
gudyn 2007-11-03
  • 打赏
  • 举报
回复
这是一个好消息,不是坏消息。
sjjf 2007-11-03
  • 打赏
  • 举报
回复
cpp会不会变认不出来了?
Waiting4you 2007-11-01
  • 打赏
  • 举报
回复
非常感谢longshanks,

看了您的解释,我想是不是可以这么理解:
raii 就是用类似智能指针(各种策略)的方式管理资源
concurrency 就是相当于加入了OpenMP
abi 就是有了各编译器产商做编译器在生成二进制时的标准(接口方面)
concept 好像Boost里就有一个Concept_check类库,不知道是不是和它的功能类似
Initializer lists 这个功能不错,喜欢:-)
benjiam 2007-11-01
  • 打赏
  • 举报
回复
..... 人家c语言 什么都不支持

bsd linux apapch 无数巨牛无比的东西都开发除啦.很多东西还得靠人。


美国科学家60年代靠的cpu 没你现在的好吧。 你能做人家60年代做的事情吗?

....努力 +U
healer_kx 2007-11-01
  • 打赏
  • 举报
回复
C#单纯从语法上说,有很多可取之处,比如说属性,看起来还是很优美的。再比如说override等关键字的设计,也很能去处一些混淆。
但是它的模板太低级了,也就是比Java强点,又不能以Delegate作为Constraint,我就日了。
Cocoky 2007-11-01
  • 打赏
  • 举报
回复
GC本身就是垃圾,也要背回收,应该是好消息
lbaby 2007-11-01
  • 打赏
  • 举报
回复
C# 离了吻到死就不能用,这算什么
别什么4个+了,一个都比不上
redex 2007-11-01
  • 打赏
  • 举报
回复
"加了GC...

C++.Net ?? "

---虽然 不喜欢往c++中加GC, 但貌似近几年大师们都在说: c++中加入gc很重要!!
healer_kx 2007-11-01
  • 打赏
  • 举报
回复
C++只要兼容一部分必要的C就足够了,能删除的都删除。
mimong_lin 2007-11-01
  • 打赏
  • 举报
回复
UP
shrinerain 2007-11-01
  • 打赏
  • 举报
回复
加了GC...

C++.Net ??
jackeyabc 2007-10-31
  • 打赏
  • 举报
回复
幫頂
菜鳥
ryfdizuo 2007-10-31
  • 打赏
  • 举报
回复
路过~~~UP
blackmurder 2007-10-31
  • 打赏
  • 举报
回复
学习
mx81831 2007-10-31
  • 打赏
  • 举报
回复
up!
longshanks 2007-10-31
  • 打赏
  • 举报
回复
加了 gc 只好回 c 去了
==============================
0x的gc是可选的,可以关掉,也可以全自动,也可以半自动(忽略手工内存管理,gc处理剩下的。)
加载更多回复(31)

64,651

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧