Can different optimization levels lead to functionally different code?

前端 未结 13 1939
[愿得一人]
[愿得一人] 2020-12-13 12:39

I am curious about the liberties that a compiler has when optimizing. Let\'s limit this question to GCC and C/C++ (any version, any flavour of standard):

Is it possi

13条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 13:09

    Since copy constructor calls can be optimized away, even if they have side effects, having copy constructors with side-effects will cause unoptimized and optimized code to behave differently.

提交回复
热议问题