You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Armclang/Armcc是否支持复制消除?是否有类似GCC的禁用选项?

Answer to Your Arm Compiler Copy Elision Question

Great question—let's clear this up for you since it's not always obvious in the docs at first glance:

  • Do armclang/armcc support copy elision?
    Absolutely! Both compilers fully support copy elision (including Return Value Optimization, RVO, and Named Return Value Optimization, NRVO) as required by the C++ standard. This optimization is enabled by default in release builds (and even most debug builds unless you explicitly disable optimizations).

  • What are the equivalent flags to disable copy elision?

    • For armclang: Since it's built on LLVM/Clang and maintains strong GCC compatibility, you can use the exact same flag as GCC: -fno-elide-constructors. This will turn off all copy and move constructor elision.
    • For armcc (the legacy Arm compiler, now superseded by armclang), the equivalent flag is --no_elide_constructors (note the double hyphens and underscore instead of hyphens).

If you want to confirm these flags exist for your specific compiler version, you can run a quick help command like armclang --help | grep elide or armcc --help | grep elide to see the option listed directly.

内容的提问来源于stack exchange,提问作者Michael Guo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 22:44:05