Vin*_*ent 7 c++ arguments standards-compliance c++11 c++-chrono
请考虑以下代码(LWS):
#include <iostream>
#include <chrono>
inline void test(
const std::chrono::high_resolution_clock::time_point& first,
const std::chrono::high_resolution_clock::time_point& second)
{
std::cout << first.time_since_epoch().count() << std::endl;
std::cout << second.time_since_epoch().count() << std::endl;
}
int main(int argc, char* argv[])
{
test(std::chrono::high_resolution_clock::now(),
std::chrono::high_resolution_clock::now());
return 0;
}
Run Code Online (Sandbox Code Playgroud)
你必须多次运行它,因为有时,没有明显的区别.但是,当存在的评价的时间之间的可见的差别first和second,结果是下克++以下内容:
1363376239363175
1363376239363174
Run Code Online (Sandbox Code Playgroud)
英特尔和clang下面的以下内容:
1363376267971435
1363376267971436
Run Code Online (Sandbox Code Playgroud)
这意味着在g ++下,second首先评估参数,在intel和clang下first首先评估参数.
根据C++ 11标准,哪一个是真的?
| 归档时间: |
|
| 查看次数: |
735 次 |
| 最近记录: |