C++ Logo

sg15

Advanced search

Re: [isocpp-core] unimported implementation partitions

From: Daniel Ruoso <daniel_at_[hidden]>
Date: Wed, 8 Jun 2022 16:11:07 -0400
Em qua., 8 de jun. de 2022 às 15:51, Herring, Davis <herring_at_[hidden]> escreveu:
> The converse does not hold, so I would not expect the behavior of
> a well-formed program that includes an implementation partition T
> by virtue of explicit nomination to the linker to change if an import
> of T is introduced in an otherwise empty translation unit. If the importer
> is non-empty, of course, [basic.start.dynamic]/2.2 may cause the
> import to change the order of non-local initialization, as well as
> suppressing the freedom otherwise afforded by /5 to ignore entirely
> a translation unit that contains just an unused variable with side effects in its initializer.

I would actually go further and say that for a module internal
partition to be a part of the program, it needs to be imported by a
translation unit that is itself part of the program. So recursively,
if the only thing importing a module is something that is ignored by
the linker, it's the same thing as it not being imported anywhere.

daniel

Received on 2022-06-08 20:11:19