diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-15 03:17:13 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-15 03:17:13 +0000 |
commit | 83d38847084605a0ec0e405573322680975b4897 (patch) | |
tree | 89e018a6103d524314b24d1f934f1e43152fbcd2 | |
parent | f028287669aefde4e23ab61929107133fef25165 (diff) | |
download | ATCD-83d38847084605a0ec0e405573322680975b4897.tar.gz |
added guideline for protection of header files against
multiple inclusion
-rw-r--r-- | docs/ACE-guidelines.html | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/ACE-guidelines.html b/docs/ACE-guidelines.html index 52c5e0cc96f..cfe40056943 100644 --- a/docs/ACE-guidelines.html +++ b/docs/ACE-guidelines.html @@ -149,6 +149,23 @@ bgcolor="#ffffff"> const ASYS_TCHAR *net_if, #endif /* ! ACE_PSOS */ </pre><p> + + <li>Protect header files against multiple inclusion with this + construct: + <pre> + #ifndef FOO_H + #define FOO_H + + [contents of header file] + + #endif /* FOO_H */ + </pre><p> + + This exact construct (note the <code>#ifndef</code>) + is optimized by many compilers such they only open the + file once per compilation unit. <strong>No</strong> code + can appear after the final <code>#endif</code> for the + optimization to be effective and correct.<p> </ul> <li><strong>C++ Syntax and Constructs</strong><p> |