Boost logo

Boost :

From: Daniela Engert (dani_at_[hidden])
Date: 2023-02-28 07:19:47


Am 28.02.2023 um 07:51 schrieb Gavin Lambert via Boost:
> On 28/02/2023 19:02, Daniela Engert wrote:
>> Am 28.02.2023 um 00:02 schrieb Gavin Lambert:
>>> That's what precompiled headers are for.
>>
>> Right - possibly.
>> Unless you have progressed into the world of modules where you better
>> stay away from PCH unless you're a fan of ODR violations and lots of
>> "surprises".
>
> If PCH doesn't work in the module world, that's not "progress". :)
>
> I'd sooner give up modules than PCH, and you should probably report
> those sorts of things as bugs if they can be reproduced.

Oh, nevermind, they do work. The problem is that you can end up in a
situation where you have the same entity declared through the PCH
(typically) attached to the global module and imported from a named
module where it is (probably) attached to that (or another) module. And
various combinations of that along direct and/or indirect
#includes/imports. Mixing attachments in the same program is IF-NDR. To
avoid that I usually have a configuration option to control attachment
of entities exported from a named module if the library in question is
used as a module in some parts of the program and through #includes in
others - not uncommon during the transition period. A prominent example
is Asio, one of the underpinnings of most projects in our company.

That may be the reason why contacts from within Microsoft's compiler
team were hinting at me to be careful with mixing PCH and modules and to
not be too surprised when doing so. The more I use modules in my
projects the more I am willing to ditch PCH and go with the strictly
more powerful modules.

-- 
PGP/GPG: 2CCB 3ECB 0954 5CD3 B0DB 6AA0 BA03 56A1 2C4638C5

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk