Rules for Matching the Initial Sequence

Once the precompiled initial sequence is created, it can be used in subsequent compiles. Other compilation units can use the precompiled initial sequence under the following conditions:

Example
Given two compilation units, prog1.c and prog2.c:

prog1.c 		prog2.c
----------------------- -------------------------
#undef X 		#define X 1
#include "h1.h" 	#include "h1.h"
#include "h2.h" 	#include "h2.h"
func1() {} 		func2() {}

h1.h
----------------------
#if TEST
int h1;
#endif

h2.h
----------------------
char h2 = M;

The file prog2.c can use the precompiled header object from prog1.c when:

The different definitions of X in prog1.c and prog2.c do not matter, since X is never tested or expanded.



Precompiled Headers


Example of an Initial Sequence