Date: Thu, 5 Mar 2026 12:47:24 +0000
On 03/03/2026 11:05, Jonathan Grant wrote:
>
>
> On 20/02/2026 11:27, Sebastian Wittmeier via Std-Proposals wrote:
>> Can this feature proposal be lifted from a best-effort base to be reproducible?
>
> I think optimizers are just opportunistic, dependent upon the compiler settings as I understand it.
>
Could the optimizer perhaps remove the if() that was added by the programmer after seeing the compile_assert() error?
void f(const char * buf, size_t idx, char byte)
{
if(idx < max_val)
{
buf[i] = byte);
}
}
Otherwise I need to have something read from a config file (just to satisfy optimizer)
volatile bool setting = something_from_runtime;
void f(const char * buf, size_t idx, char byte)
{
if(something_from_runtime)
{
if(idx < max_val)
{
buf[i] = byte);
}
}
}
I wonder if even that might be optimized out.
Jonathan
>
>
> On 20/02/2026 11:27, Sebastian Wittmeier via Std-Proposals wrote:
>> Can this feature proposal be lifted from a best-effort base to be reproducible?
>
> I think optimizers are just opportunistic, dependent upon the compiler settings as I understand it.
>
Could the optimizer perhaps remove the if() that was added by the programmer after seeing the compile_assert() error?
void f(const char * buf, size_t idx, char byte)
{
if(idx < max_val)
{
buf[i] = byte);
}
}
Otherwise I need to have something read from a config file (just to satisfy optimizer)
volatile bool setting = something_from_runtime;
void f(const char * buf, size_t idx, char byte)
{
if(something_from_runtime)
{
if(idx < max_val)
{
buf[i] = byte);
}
}
}
I wonder if even that might be optimized out.
Jonathan
Received on 2026-03-05 12:47:27
