C++ Logo

sg15

Advanced search

Re: Questions about wording and design intention for header units and ideas

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Wed, 24 May 2023 00:15:37 +0200
On 23/05/2023 21.48, Tom Honermann via SG15 wrote:
> On 5/21/23 9:48 PM, 许传奇(夜灯) wrote:
>> Hi Boris,
>>
>> > The standard is pretty clear that an imported header does not "see"
>> any macros defined by the importer.
>>
>> This is surprising to me. Where is the corresponding wording? I just searched
>> the context and didn't find the wording. And if it is true, it implies that the following
>> transition is invalid, isn't it?
> I think the most applicable wording is [module.import]p5 <http://eel.is/c++draft/module.import#5>. It defines how a header unit is constructed and, since it doesn't specify that the state of the preprocessor at the point of import is involved, that presumably means that it isn't.

That is my interpretation as well.

I do want to point out that command-line macro definitions might
influence the synthesis of a header unit (those are arguably
active during those phases 1-7, similar to predefined macros),
and thus changing the set of command-line macros arguably
invalidates all header unit artifacts hitherto created in the
project. But I'm not seeing how this would be novel; changing
some ABI flag on the command line must cause a full rebuild, too.

Jens

Received on 2023-05-23 22:15:59