C++ Logo

sg15

Advanced search

Header units and dependency scanning

From: Daniel Ruoso <daniel_at_[hidden]>
Date: Thu, 9 Jun 2022 13:30:50 -0400
I'm continuing my effort to create a coherent mental model of how
header units need to work, and I just realized something that looks
problematic.

Let's suppose you have the header foo.h:

```
#ifndef INCLUDED_FOO_H
#define INCLUDED_FOO_H
#define SOMETHING 1
#endif
```

Now, let's suppose you have another header, let's say bar.h, with:

```
import <foo.h>
#ifdef SOMETHING
import <something.h>
#else
import <somethingelse.h>
#endif
```

Let's suppose both `foo.h` and `bar.h` are importable headers.

In the dependency scanning phase, we're not expected to have a bmi for
all units yet, since we don't know the order in which we're meant to
process them.

How is the dependency scanning supposed to work in that case?

Or am I fundamentally misunderstanding how this works?

daniel

Received on 2022-06-09 17:31:02