C++ Logo

std-proposals

Advanced search

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

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Mon, 30 Jan 2023 18:45:14 +0000
On Mon, 30 Jan 2023 at 18:38, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Sunday, 29 January 2023 13:11:48 PST Jason McKesson via Std-Proposals
> wrote:
> > Also, how does Itanium-based code work if you have a member pointer in
> > static storage that gets zero-initialized? Does something have to
> > manually fill in the -1s at runtime, or does an object containing such
> > a member pointer have to take up space in static executable storage?
>
> The static storage then isn't zero-initialised. It's value-initialised to
> -1.
>
> Ditto for MSVC ABI.
>
> https://gcc.godbolt.org/z/ohqzsYrG8
>

 ... implying it occupies space in .data, rather than being encoded by
length in .bss. Interestingly, clang puts simple pointers in .data,
presumably on the basis that the same amount of space is occupied in the
executable image, and it's faster at load time.

Received on 2023-01-30 18:45:27