3.24 Precompiled Header (PCH) file processing and the header stop point

The PCH file contains a snapshot of all the code that precedes a header stop point.

Typically, the header stop point is the first token in the primary source file that does not belong to a preprocessing directive. In the following example, the header stop point is int and the PCH file contains a snapshot that reflects the inclusion of xxx.h and yyy.h:
#include "xxx.h"
#include "yyy.h"
int i;
You can manually specify the header stop point with #pragma hdrstop. If you use this pragma, it must appear before the first token that does not belong to a preprocessing directive. In this example, it must be placed before int, as follows:
#include "xxx.h"
#include "yyy.h"
#pragma hdrstop
int i;
If a #if block encloses the first non-preprocessor token or #pragma hdrstop, the header stop point is the outermost enclosing #if. For example:
#include "xxx.h"
#ifndef YYY_H
#define YYY_H 1
#include "yyy.h"
#endif
#if TEST /* Header stop point lies immediately before #if TEST */
int i;
#endif
In this example, the first token that does not belong to a preprocessing directive is int, but the header stop point is the start of the #if block containing it. The PCH file reflects the inclusion of xxx.h and, conditionally, the definition of YYY_H and inclusion of yyy.h. It does not contain the state produced by #if TEST.
Related concepts
3.22 Precompiled Header (PCH) files
3.23 Automatic Precompiled Header (PCH) file processing
3.25 Precompiled Header (PCH) file creation requirements
3.26 Compilation with multiple Precompiled Header (PCH) files
3.27 Obsolete Precompiled Header (PCH) files
3.28 Manually specifying the filename and location of a Precompiled Header (PCH) file
3.29 Selectively applying Precompiled Header (PCH) file processing
3.30 Suppressing Precompiled Header (PCH) file processing
3.31 Message output during Precompiled Header (PCH) processing
3.32 Performance issues with Precompiled Header (PCH) files
Related reference
7.120 --pch
7.121 --pch_dir=dir
9.81 #pragma hdrstop
Non-ConfidentialPDF file icon PDF versionARM DUI0375E
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.