Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ c++;:循环增量部分的操作顺序_C++_Specifications - Fatal编程技术网

C++ c++;:循环增量部分的操作顺序

C++ c++;:循环增量部分的操作顺序,c++,specifications,C++,Specifications,考虑以下代码: int totalLength = 0; int partLength = 0; for(; totalLength < SOME_CONST; totalLength += partLength, partLength = 0) { //partLength may be increased here } int总长度=0; int partLength=0; 对于(;totalLength

考虑以下代码:

int totalLength = 0;
int partLength = 0;
for(; totalLength < SOME_CONST; totalLength += partLength, partLength = 0)
{
    //partLength may be increased here
}
int总长度=0;
int partLength=0;
对于(;totalLength<某些常数;totalLength+=零件长度,零件长度=0)
{
//零件长度可以在此处增加
}

在这种特殊情况下,我是否可以假设partLength在添加到totalLength后将设置为0(因此,如果partLength在循环体中增加,我不会在循环结束时将0添加到totalLength)?我读过C++序列,但没有找到任何明确的答案。逗号运算符的左侧在右侧之前排序
totalLength+=partLength
在执行
partLength=0

之前将对其进行完全评估,因此它不依赖于实现?恐怕是的,所以这个问题。@PookyFan不是。你也可以读更多关于它的内容。