C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A type trait to detect if value initialization can be achieved by zero-filling

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 30 Jan 2023 13:56:55 +0200
On Mon, 30 Jan 2023 at 13:48, Bo Persson via Std-Proposals
<std-proposals_at_[hidden]> wrote:

> > Ok, I got it now. But again, why imposing anything? We're entirely in
> > implementation-defined territory. "Who cares" if on some fancy
> > architecture `int *x=0;` is zero-filled and `float *y=0;` is not? The
> > compiler will tell you the truth for each different type.
> >
>
> I care if the code happens to compile on my machine, but nowhere else.
>
> Where is the portability, and how do you test the code?

This proposal is for a facility that hooks into implementation-defined
properties in order
to allow writing optimized implementations based on them. If your
foremost concern is portability
in the sense of your code having the exact same semantics on every
implementation, don't use it.

Received on 2023-01-30 11:57:08