Order of evaluation of arguments using std::cout

前端 未结 5 1079
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 13:26

Hi all I stumbled upon this piece of code today and I am confused as to what exactly happens and more particular in what order :

Code :

#include &l         


        
5条回答
  •  旧时难觅i
    2020-11-22 14:11

    The order of evaluation is unspecified, see http://en.wikipedia.org/wiki/Sequence_point

    This is the same situation as the example with the operator+ example:

    Consider two functions f() and g(). In C and C++, the + operator is not associated with a sequence point, and therefore in the expression f()+g() it is possible that either f() or g() will be executed first.

提交回复
热议问题