SUBEX pressions评估顺序 [英] subexpressions evaluation order

查看:107
本文介绍了SUBEX pressions评估顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了 SO / IEC 9899: 201X下J.1不确定的行为的:

"The order in which subexpressions are evaluated and the order in which side effects
take place, except as specified for the function-call (), &&, ||, ?:, and comma
operators (6.5)."

这是否意味着,在

Does this means that in

func1() + func2();

FUNC2()而定)func1的(前pformed $ P $,甚至在func1的()?

func2() may be preformed before func1(), or even during func1() ?

推荐答案

在当前的标准(ISO / IEC 9899:1999)有函数调用,但是操作数的计算顺序之间的序列点 + 没有指定这样 FUNC1 可称为前或后 FUNC2 但函数调用必须不重叠或以任何方式进行交织。

In the current standard (ISO/IEC 9899:1999) there is a sequence point between function calls but the order of evaluation of the operands to + is not specified so func1 may be called before or after func2 but the function calls must not overlap or be interleaved in any way.

这意味着,每个 FUNC1 FUNC2 可以,如果需要的话,有一些共享的数据交互,而具有以意想不到的方式下,其数据的变化。

This means that each of func1 and func2 can, if desired, interact with some shared data without having that data change under it in an unexpected way.

这篇关于SUBEX pressions评估顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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