Disabling g++'s return-value optimisation

前端 未结 1 1536
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-02 15:07

What flag(s) do I need on the command line to disable the return-value optimisation automatically enabled by the g++ compiler?

相关标签:
1条回答
  • 2020-12-02 15:52

    -fno-elide-constructors

    The C++ standard allows an implementation to omit creating a temporary which is only used to initialize another object of the same type. Specifying this option disables that optimization, and forces G++ to call the copy constructor in all cases. [Source: man gcc]


    0 讨论(0)
提交回复
热议问题