Date: Fri, 19 Sep 2025 12:09:47 +0800
On Fri, 19 Sept 2025 at 04:26, Thiago Macieira via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> On Wednesday, 17 September 2025 23:28:45 Pacific Daylight Time Yongwei Wu via
> Std-Discussion wrote:
> > First, programmers in general do not want to *rely on* compiler
> > optimizations to get rid of unused code.
>
> Yes, they do. ALL the time, especially in template code but anything that is
> not nailed down and may have some generality too. For example, anything that
> may depend on a configuration-time feature check. Given we have the __cpp
> macros describing the availability of features, this applies to the C++
> Standard too.
Arguable, especially if -O0 demonstrates completely different
behaviour. I would normally use #if or if constexpr to ensure
something is really eliminated, even if optimization is completely
turned off.
<std-discussion_at_[hidden]> wrote:
>
> On Wednesday, 17 September 2025 23:28:45 Pacific Daylight Time Yongwei Wu via
> Std-Discussion wrote:
> > First, programmers in general do not want to *rely on* compiler
> > optimizations to get rid of unused code.
>
> Yes, they do. ALL the time, especially in template code but anything that is
> not nailed down and may have some generality too. For example, anything that
> may depend on a configuration-time feature check. Given we have the __cpp
> macros describing the availability of features, this applies to the C++
> Standard too.
Arguable, especially if -O0 demonstrates completely different
behaviour. I would normally use #if or if constexpr to ensure
something is really eliminated, even if optimization is completely
turned off.
-- Yongwei Wu URL: http://wyw.dcweb.cn/
Received on 2025-09-19 04:10:05