Why the following function is called thrice

后端 未结 6 1312
轻奢々
轻奢々 2021-01-20 10:45

I had tried to debug but no luck I can\'t understand why the second printf() is call increment() thrice but the first one call twice as expected.

#include &l         


        
6条回答
  •  天命终不由人
    2021-01-20 11:35

    This happens because your macro will expand as ( (x) > (increment()) ? (x) : (increment()) ).

    However, this is not the only problem, your code contains undefined behaviour. Parameters are not evaluated in a specified order.

提交回复
热议问题