Is it legal for a C++ optimizer to reorder calls to clock()?

前端 未结 7 1899
清歌不尽
清歌不尽 2020-12-02 10:55

The C++ Programming Language 4th edition, page 225 reads: A compiler may reorder code to improve performance as long as the result is identical to that of the s

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 11:33

    Yes, it is legal - if the compiler can see the entirety of the code that occurs between the clock() calls.

提交回复
热议问题