有没有任何情况下代码在c ++ 11而不是c ++ 03有一个序列点? [英] Are there any situations where code would have a sequence point in c++11 but not c++03?

查看:92
本文介绍了有没有任何情况下代码在c ++ 11而不是c ++ 03有一个序列点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在新的c ++ 11标准已经改变了序列点的描述,我试图找出在c ++ 03和c ++ 11之间发生了什么变化。

Now that the new c++11 standard has made changes in how sequence points are described I'm trying to find out exactly what has been changed between c++03 and c++11.

特别是,有什么情况下看起来一样的代码在c ++ 11而不是c ++ 03中有一个序列点?

In particular, are there any situations where code that looks the same would have a sequence point in c++11 but not c++03?

推荐答案

在C ++ 11中没有序列点,而是在关系之后进行排序和排序。

There are no sequence points in C++11, rather there are sequenced before and sequenced after relations.

这里有一些小例子,其中C ++ 03和C ++ 11之间的行为不同

Here are some trivial examples wherein behavior differ between C++03 and C++11

int x = 10;
++++x; // well defined in C++11

int x = 10;
x = ++x +1; //well defined in C++11

为什么?请查看答案及相关主题。

Why? Have a look at this answer and related threads.

这篇关于有没有任何情况下代码在c ++ 11而不是c ++ 03有一个序列点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆