Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/124.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++_Function_Expression_Iso - Fatal编程技术网

C++ C++;传递函数参数时的执行顺序

C++ C++;传递函数参数时的执行顺序,c++,function,expression,iso,C++,Function,Expression,Iso,具有以下接口的容器类: template <typename T> class DynArray { /// Returns the number of elements in the array. inline size_t GetCount(); /// Releases the internal memory from the \class DynArray /// and returns it. The memory must be deallocated m

具有以下接口的容器类:

template <typename T> class DynArray {
  /// Returns the number of elements in the array.
  inline size_t GetCount();
  /// Releases the internal memory from the \class DynArray
  /// and returns it. The memory must be deallocated manually.
  inline T* Release();
}
我本来希望在
arr.Release()
之前调用
arr.GetCount()
,但实际情况似乎相反,导致第一个参数被传递一个值
0
,而不是实际的数组大小。我正在使用Visual Studio 2012


C++标准是否在评估函数参数时说了具体的执行顺序?

< P>,它表示顺序完全未指定。< /P> 排序规则太复杂,无法在这里复制,很难证明是否定的,但非规范性注释方便地为我们总结了它:

[C++11:5.2.2/4]:
调用函数时,每个参数(8.3.5)应使用相应的参数初始化(8.5、12.8、12.1)。[注:此类初始化相互之间的顺序不确定(1.9)-结束注][…]


(与C++14中的文本相同。)

当作为参数传递时,标准不强制执行顺序,这由实现者决定:
SomeFunction(arr.GetCount(), arr.Release())