C++ Logo

sg15

Advanced search

Re: "logical name" of importable headers

From: Daniel Ruoso <daniel_at_[hidden]>
Date: Tue, 7 Jun 2022 10:28:07 -0400
Em ter., 7 de jun. de 2022 às 10:22, Mathias Stearn via SG15
<sg15_at_[hidden]> escreveu:
> Don't we already have an extremely portable format for that
> "metadata"? If you make a directory with all of the header paths
> you want to remap and have them contain a single
> `import named.module;` line, and inject that directory to the
> front of your include paths, this should work out of the box
> for all compilers. Why do we need a new metadata format for this?

That is not sufficient, unfortunately. If we want to allow the
compiler to silently replace an `#include <foo.h>` with `import
<foo.h>`, it's important that the behavior remains the same.

Importing a named module does not result in a `#define` done in the
header to be made available in the scope after the importation. While
doing `import <foo.h>` does.

Therefore providing the compiler with the list of header units needs
to happen even before the dependency scanning.

daniel

Received on 2022-06-07 14:28:19