Does bitwise-or guarantee an evaluation ordering?

你说的曾经没有我的故事 提交于 2019-12-01 02:38:56

No, there is no guarantee which order the functions will be called in. Unlike ||, | does not imply a sequence point.

All functions in the expression must be called unless the implementation can determine that they have no side-effects and it can determine the result of the expression without actually calling one of the functions. The implementation can do this under the "as if" rule which allows the implementation to perform any optimization which cannot be observed or detected by a conforming program.

It will not short circuit. It may execute out of order.

"The direction of evaluation does not affect the results of expressions that include more than one multiplication (*), addition (+), or binary-bitwise (& | ^) operator at the same level."

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!