关于C++0x内存模型和序列点的一些思考

本文探讨了C++0x并发内存模型提案(N2052)中关于序列点和函数参数评估顺序的问题。作者指出,未指定的评估顺序是否允许重叠,以及这与“未顺序化”的概念如何区别。文章提出了多个问题,包括函数参数的重叠计算、未定义行为的例子,并讨论了标准中的模糊之处,如子表达式顺序的可接受排列。
摘要由CSDN通过智能技术生成

 Several questions about sequence point and concurrent memory model. (mostly focused on N2052)

这几天断断续续一直在看关于C++0x的并发内存模型的proposal,这堆proposal显然是所有0x proposals里面最困难的。看的时候问题不断,单单是对原始单线程内存模型的改进和序列点概念的精化就非常tricky。所以看的时候总结了一些模糊的地方,昨天给发到comp.lang.c++.moderated上面去了, Francis Glassborow给了一个回贴澄清了里面的一个问题,不过尚留下不少其它的。相信后面还会有热心人(james kanze, maybe:))回复的,呵呵。

贴在这里,欢迎有兴趣的朋友一起探讨:-)

没时间细细转成中文的了,就直接把写的帖子贴在下面了,呵呵:)

[后记] 果然不出我所料,新闻组上的大牛人&大热心人James Kanze果然火速给出了最为详尽的回复,哈哈,我帖子里的绝大部分推测都是对的:) 有兴趣的朋友可以查看新闻组上的链接。


1. When the standard says that the order of evaluation of arguments to a function is unspecified, does that mean they could be overlapped, or just indeterminately ordered?

This problem occurs to me when I was reading Boehm's memory model proposal [N2052], in which he suggested using "sequenced before" instead of "sequence point" and then stipulated the evaluation order of function arguments as "unsequenced", which explicitly allows overlapping according to his proposal.

So, my question is, are those two constraints (i.e. "unsequenced evaluation order" and "unspecified evaluation order") essentially equal? 'cause I was thinking that "unsequenced" is looser than "unspecified evaluation order".

I couldn't find any statement about whether or not an unspecified order allows overlapping in C++98. So, Could any one give an explanation please?

 

P.S. According to another statement of the evaluation order, which says "there's an sequence point after the evaluation of all the arguments and before the entry of the function", this obviously means that the value computation and side effect of the evaluations of the arguments could take place in any order, even overlapped (?), because there's no sequence point between them, right? So the implementation is free to rearrange the instructions.

Plus, according to my understanding of the sequence point, it doesn't really matter whether or not t

评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值