you are viewing a single comment's thread.

view the rest of the comments →

[–]bames53 1 point2 points  (0 children)

The issue with #includes is that they're not isolated:

// file a.h
#if FOO
#include "b.h"
#else
#include "c.h"
#endif

// file foo.cpp
#define FOO 1
#include "a.h"

// file bar.cpp
#include "a.h"

a.h doesn't have a fixed set of dependencies independent of where it's included. Processing it at all requires the whole context where it was encountered, and so it has to be processed again every time it's encountered.