29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Compiler</strong> Coding Practices<br />

5.13 Guarding against multiple inclusion of header files<br />

Guarding against multiple inclusion of header files:<br />

• improves compilation time<br />

• reduces <strong>the</strong> size of object files generated using <strong>the</strong> -g compiler command-line option,<br />

which can speed up link time<br />

• avoids compilation errors that arise from including <strong>the</strong> same code multiple times.<br />

For example:<br />

/* foo.h */<br />

#ifndef FOO_H<br />

#define FOO_H 1<br />

...<br />

#endif<br />

/* bar.c */<br />

#ifndef FOO_H<br />

#include "foo.h"<br />

#endif<br />

5.13.1 See also<br />

Reference<br />

<strong>Compiler</strong> Reference:<br />

• -g on page 3-47.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 5-21<br />

ID061811<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!