Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2007-11-10 09:48:32


Author: danieljames
Date: 2007-11-10 09:48:31 EST (Sat, 10 Nov 2007)
New Revision: 40985
URL: http://svn.boost.org/trac/boost/changeset/40985

Log:
Add the header policy. Fixes #1354

Added:
   website/public_html/beta/development/header.html (contents, props changed)
Text files modified:
   website/public_html/beta/common/menu-development.html | 6 +++++-
   1 files changed, 5 insertions(+), 1 deletions(-)

Modified: website/public_html/beta/common/menu-development.html
==============================================================================
--- website/public_html/beta/common/menu-development.html (original)
+++ website/public_html/beta/common/menu-development.html 2007-11-10 09:48:31 EST (Sat, 10 Nov 2007)
@@ -28,8 +28,12 @@
 
     <li style="list-style: none; display: inline">
       <ul>
+ <li><a href="/development/header.html">Header policy <span class=
+ "link">&gt;</span></a></li>
+
         <li><a href="/development/int_const_guidelines.html">Coding
- Guidelines for Integral Constant Expressions</a></li>
+ Guidelines for Integral Constant Expressions <span class=
+ "link">&gt;</span></a></li>
       </ul>
     </li>
 

Added: website/public_html/beta/development/header.html
==============================================================================
--- (empty file)
+++ website/public_html/beta/development/header.html 2007-11-10 09:48:31 EST (Sat, 10 Nov 2007)
@@ -0,0 +1,147 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <title>Boost Header policy</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
+ <link rel="icon" href="/favicon.ico" type="image/ico" />
+ <link rel="stylesheet" type="text/css" href=
+ "/style/section-development.css" />
+ <!--[if IE]> <style type="text/css"> body { behavior: url(/style/csshover.htc); } </style> <![endif]-->
+</head>
+
+<body>
+ <div id="heading">
+ <!--#include virtual="/common/heading.html" -->
+ </div>
+
+ <div id="body">
+ <div id="body-inner">
+ <div id="content">
+ <div class="section" id="intro">
+ <div class="section-0">
+ <div class="section-title">
+ <h1>Boost Header policy</h1>
+ </div>
+
+ <div class="section-body">
+ <p>Header files are the place where a library comes into
+ contact with user code and other libraries. To co-exist
+ peacefully and productively, headers must be "good
+ neighbors".</p>
+
+ <p>Here are the standards for boost headers. Many of these are
+ also reasonable guidelines for general use.</p>
+
+ <ul>
+ <li>Header filenames should have a .hpp (lowercase)
+ extension.</li>
+
+ <li>Unless multiple inclusion is intended, wrap the header in
+ #ifndef guards. Use a naming convention that minimizes the
+ chance of clashes with macro names from other's code. The
+ sample header uses the Boost
+ convention of all uppercase letters, with the header name
+ prefixed by the namespace name, and suffixed with HPP,
+ separated by underscores.</li>
+
+ <li>Wrap the header contents in a namespace to prevent global
+ namespace pollution. The namespace approach to pollution
+ control is strongly preferred to older approaches such as
+ adding funny prefixes to global names. Libraries which are
+ designed to work well with other Boost libraries should be
+ placed in namespace <tt>boost</tt>.</li>
+
+ <li>Make sure that a translation unit consisting of just the
+ contents of the header file will compile successfully.</li>
+
+ <li>Place the header file in a sub-directory to prevent
+ conflict with identically named header files in other
+ libraries. The parent directory is added to the compiler's
+ include search path. Then both your code and user code
+ specifies the sub-directory in <tt>#include</tt> directives.
+ Thus the header sample header
+ would be included by <tt>#include
+ &lt;boost/furball.hpp&gt;</tt></li>
+
+ <li>The preferred ordering for class definitions is public
+ members, protected members, and finally private members.</li>
+
+ <li>Include the boost/config.hpp <a href=
+ "../libs/config/config.htm">configuration header</a> if there
+ is a need to deal with compiler or platform configuration
+ issues.</li>
+ </ul>
+
+ <h2><a name="SampleHeader" id="SampleHeader"></a>Sample
+ Header</h2>
+ <pre>
+// Boost general library furball.hpp header file ---------------------------//
+
+ &lt;<i> Copyright and license notice</i>, as indicated in the <a href=
+"/users/license.html">license page</a> &gt;
+
+// See http://www.boost.org/ for latest version.
+
+#ifndef BOOST_FURBALL_HPP
+#define BOOST_FURBALL_HPP
+
+namespace boost {
+
+// Furball class declaration -----------------------------------------------//
+
+ class furball
+ {
+ public:
+ void throw_up();
+ private:
+ int whatever;
+ }; // furball
+
+} // namespace
+
+#endif // include guard
+</pre>
+
+ <h2>Coding Style</h2>
+
+ <p>The alert reader will have noticed that the <a href=
+ "#SampleHeader">sample header</a> employs a certain coding
+ style for indentation, positioning braces, commenting ending
+ braces, and similar formatting issues. These stylistic issues
+ are viewed as personal preferences and are not part of the
+ Boost Header Policy.</p>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div id="sidebar">
+ <!--#include virtual="/common/sidebar-common.html" -->
+ <!--#include virtual="/common/sidebar-development.html" -->
+ </div>
+
+ <div class="clear"></div>
+ </div>
+ </div>
+
+ <div id="footer">
+ <div id="footer-left">
+ <div id="revised">
+ <p>Revised $Date: 2007-10-22 22:55:52 +0100 (Mon, 22 Oct 2007) $</p>
+ </div>
+
+ <div id="copyright">
+ <p>Copyright Beman Dawes 1998.</p>
+ </div><!--#include virtual="/common/footer-license.html" -->
+ </div>
+
+ <div id="footer-right">
+ <!--#include virtual="/common/footer-banners.html" -->
+ </div>
+
+ <div class="clear"></div>
+ </div>
+</body>
+</html>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk