Date: Fri, 14 Mar 2025 16:07:28 +0100
On 14/03/2025 07:56, Yongwei Wu via Std-Discussion wrote:
> P2795 was adopted last year, which said:
>
> Default-initialization of an automatic-storage object initializes the
> object with a fixed value defined by the implementation....
>
> Also the standard draft ([basic.indet]):
>
> otherwise, the bytes have erroneous values, where each value is
> determined by the implementation independently of the state of the
> program.
>
> Notice "independently of the state of the program".
>
> So my understanding is that a conforming implementation needs to fill
> the buffer (and cause a performance penalty).
I understood that sentence in the sense that filling isn't required,
because the values you'd eventually read from the buffer don't come from
the state of the program (they don't even exist, as far as the abstract
machine is concerned?).
I may be super-wrong with this interpretation, though, and I'd like some
clarity as well. If I'm mistaken, I 100% agree with you that it would be
a completely unacceptable performance hit for any class that wraps a
buffer of some sort (incl. any form of short object optimization).
My 2 c,
--
Giuseppe D'Angelo
> P2795 was adopted last year, which said:
>
> Default-initialization of an automatic-storage object initializes the
> object with a fixed value defined by the implementation....
>
> Also the standard draft ([basic.indet]):
>
> otherwise, the bytes have erroneous values, where each value is
> determined by the implementation independently of the state of the
> program.
>
> Notice "independently of the state of the program".
>
> So my understanding is that a conforming implementation needs to fill
> the buffer (and cause a performance penalty).
I understood that sentence in the sense that filling isn't required,
because the values you'd eventually read from the buffer don't come from
the state of the program (they don't even exist, as far as the abstract
machine is concerned?).
I may be super-wrong with this interpretation, though, and I'd like some
clarity as well. If I'm mistaken, I 100% agree with you that it would be
a completely unacceptable performance hit for any class that wraps a
buffer of some sort (incl. any form of short object optimization).
My 2 c,
--
Giuseppe D'Angelo
Received on 2025-03-14 15:07:32