lib_guide.htm 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <html>
  2. <head>
  3. <title>Boost Library Requirements and Guidelines</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
  6. <meta name="ProgId" content="FrontPage.Editor.Document">
  7. <meta name="Microsoft Border" content="none, default">
  8. </head>
  9. <body bgcolor="#ffffff" text="#000000">
  10. <table border="1" bgcolor="#007f7f" cellpadding="2">
  11. <tr>
  12. <td bgcolor="#ffffff"><img src="../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"></td>
  13. <td><a href="../index.htm"><font face="Arial" color="#ffffff"><big>Home</big></font></a></td>
  14. <td><a href="../libs/libraries.htm"><font face="Arial" color="#ffffff"><big>Libraries</big></font></a></td>
  15. <td><a href="../people/people.htm"><font face="Arial" color="#ffffff"><big>People</big></font></a></td>
  16. <td><a href="faq.htm"><font face="Arial" color="#ffffff"><big>FAQ</big></font></a></td>
  17. <td><a href="index.htm"><font face="Arial" color="#ffffff"><big>More</big></font></a></td>
  18. </tr>
  19. </table>
  20. <h1 align="left">Boost Library Requirements and Guidelines</h1>
  21. <p align="left"><a href="#Introduction">Introduction</a><br>
  22. <a href="#Requirements">Requirements</a><br>
  23. &nbsp;&nbsp;&nbsp; <a href="#License">License requirements</a><br>
  24. &nbsp;&nbsp;&nbsp; <a href="#Portability">Portability requirements</a><br>
  25. &nbsp;&nbsp;&nbsp; <a href="#Ownership">Ownership</a><br>
  26. <a href="#Guidelines">Guidelines</a><br>
  27. &nbsp;&nbsp;&nbsp; <a href="#Design_and_Programming">Design and programming</a><br>
  28. &nbsp;&nbsp;&nbsp; <a href="#Directory_structure">Directory structure and
  29. filenames</a><br>
  30. &nbsp;&nbsp;&nbsp; <a href="#Naming&shy;_consistency">Naming consistency</a><br>
  31. &nbsp;&nbsp;&nbsp; <a href="#Documentation">Documentation</a><br>
  32. <a href="#Rationale">Rationale</a><br>
  33. &nbsp;&nbsp;&nbsp; <a href="#Exception-specification">Exception-specification
  34. rationale</a><br>
  35. &nbsp;&nbsp;&nbsp; <a href="#Naming">Naming conventions rationale</a><br>
  36. &nbsp;&nbsp;&nbsp; <a href="#code_fonts">Source code fonts rationale</a><br>
  37. &nbsp;&nbsp;&nbsp; <a href="#Tabs">Tabs rationale</a><br>
  38. &nbsp;&nbsp;&nbsp; <a href="#JavaScript">ECMAScript/JavaScript rationale</a><br>
  39. &nbsp;&nbsp;&nbsp; <a href="#Rationale_rationale">Rationale rationale</a><br>
  40. &nbsp;&nbsp;&nbsp; <a href="#Acknowledgements">Acknowledgements rationale</a></p>
  41. <h2 align="left"><a name="Introduction">Introduction</a></h2>
  42. <p align="left">This page describes requirements and guidelines for the content of
  43. a library submitted to Boost.</p>
  44. <p align="left">See the <a href="submission_process.htm">Boost Library Submission
  45. Process</a> page for a description of the process involved.</p>
  46. <h2 align="left"><a name="Requirements">Requirements</a></h2>
  47. <p>To avoid the frustration and wasted time of a proposed library being rejected,
  48. it must meets these requirements:</p>
  49. <ul>
  50. <li>
  51. The license must meet the <a href="#License">license requirements</a>
  52. below. Restricted licenses like the GPL and LGPL are not acceptable.
  53. <li>
  54. The copyright <a href="#Ownership">ownership</a>
  55. must be clear.
  56. <li>
  57. The library must be generally useful and not restricted to a narrow problem
  58. domain.
  59. <li>
  60. The library must meet the <a href="#Portability">portability requirements</a>
  61. below.&nbsp;
  62. <li>
  63. The library must come reasonably close to meeting the <a href="#Guidelines">Guidelines</a>
  64. below.
  65. <ul>
  66. <li>
  67. <a href="#Design_and_Programming">Design and Programming</a>
  68. <li>
  69. <a href="#Directory_structure">Directory Structure</a>
  70. <li>
  71. <a href="#Documentation">Documentation</a></li>
  72. </ul>
  73. <li>
  74. The author must be willing to participate in discussions on the mailing list,
  75. and to refine the library accordingly.</li>
  76. </ul>
  77. <p>There's no requirement that an author read the mailing list for a time before
  78. making a submission. It has been noted, however, that submissions which begin
  79. "I just started to read this mailing list ..." seem to fail, often
  80. embarrassingly.</p>
  81. <h3 align="left"><a name="License">License</a> requirements</h3>
  82. <p>The preferred way to meet the license requirements is to use the <a href="../LICENSE_1_0.txt">
  83. Boost Software License</a>. See <a href="license_info.html">license information</a>.
  84. If for any reason you do not intend to use the Boost Software License, please
  85. discuss the issues on the Boost <a href="mailing_lists.htm#main">developers
  86. mailing list</a> first.</p>
  87. <p>The license requirements:</p>
  88. <ul>
  89. <li>
  90. Must be simple to read and understand.
  91. <li>
  92. Must grant permission without fee to copy, use and modify the software for any
  93. use (commercial and non-commercial).
  94. <li>
  95. Must require that the license appear on all copies of the software source code.
  96. <li>
  97. Must not require that the license appear with executables or other binary uses
  98. of the library.
  99. <li>
  100. Must not require that the source code be available for execution or other
  101. binary uses of the library.
  102. <li>
  103. May restrict the use of the name and description of the library to the standard
  104. version found on the Boost web site.</li>
  105. </ul>
  106. <h3 align="left"><a name="Portability">Portability</a> requirements</h3>
  107. <ul>
  108. <li>
  109. <p align="left">A library's interface must portable and not restricted to a
  110. particular compiler or operating system.</p>
  111. <li>
  112. <p align="left">A library's implementation must if possible be portable and not
  113. restricted to a particular compiler or operating system.&nbsp; If a portable
  114. implementation is not possible, non-portable constructions are acceptable if
  115. reasonably easy to port to other environments, and implementations are provided
  116. for at least two popular operating systems (such as UNIX and Windows).</p>
  117. <li>
  118. <p align="left">There is no requirement that a library run on C++ compilers which
  119. do not conform to the ISO standard.&nbsp;</p>
  120. <li>
  121. <p align="left">There is no requirement that a library run on any particular C++
  122. compiler.&nbsp; Boost contributors often try to ensure their libraries work
  123. with popular compilers.&nbsp; The boost/config.hpp <a href="../libs/config/config.htm">
  124. configuration header</a> is the preferred mechanism for working around
  125. compiler deficiencies.</p>
  126. </li>
  127. </ul>
  128. <p align="left">Since there is no absolute way to prove portability, many boost
  129. submissions demonstrate practical portability by compiling and executing
  130. correctly with two different C++ compilers, often under different operating
  131. systems.&nbsp; Otherwise reviewers may disbelieve that porting is in fact
  132. practical.</p>
  133. <h3 align="left"><a name="Ownership">Ownership</a></h3>
  134. <p align="left">Are you sure you own the library you are thinking of
  135. submitting?&nbsp;&nbsp; "How to Copyright Software" by MJ Salone, Nolo Press,
  136. 1990 says:</p>
  137. <blockquote>
  138. <p align="left">Doing work on your own time that is very similar to programming
  139. you do for your employer on company time can raise nasty legal problems.&nbsp;
  140. In this situation, it's best to get a written release from your employer in
  141. advance.</p>
  142. </blockquote>
  143. <p align="left">Place a copyright notice in all the important files you submit.
  144. Boost won't accept libraries without clear copyright information.</p>
  145. <h2 align="left"><a name="Guidelines">Guidelines</a></h2>
  146. <p align="left">Please use these guidelines as a checklist for preparing the
  147. content a library submission.&nbsp; Not every guideline applies to every
  148. library, but a reasonable effort to comply is expected.</p>
  149. <h3><a name="Design_and_Programming">Design and Programming</a></h3>
  150. <ul>
  151. <li>
  152. Aim first for clarity and correctness; optimization should be only a secondary
  153. concern in most Boost libraries.</li>
  154. </ul>
  155. <ul>
  156. <li>
  157. Aim for ISO Standard C++. Than means making effective use of the standard
  158. features of the language, and avoiding non-standard compiler extensions. It
  159. also means using the C++ Standard Library where applicable.</li>
  160. </ul>
  161. <ul>
  162. <li>
  163. Headers should be good neighbors. See the <a href="header.htm">header policy</a>.
  164. See <a href="#Naming&shy;_consistency">Naming consistency</a>.</li>
  165. </ul>
  166. <ul>
  167. <li>
  168. Follow quality programming practices. See, for example, "Effective C++" 2nd
  169. Edition, and "More Effective C++", both by Scott Meyers, published by Addison
  170. Wesley.</li>
  171. </ul>
  172. <ul>
  173. <li>
  174. Use the C++ Standard Library or other Boost libraries, but only when the
  175. benefits outweigh the costs.&nbsp; Do not use libraries other than the C++
  176. Standard Library or Boost. See <a href="library_reuse.htm">Library reuse</a>.</li>
  177. </ul>
  178. <ul>
  179. <li>
  180. Read <a href="imp_vars.htm">Implementation Variation</a> to see how to supply
  181. performance, platform, or other implementation variations.</li>
  182. </ul>
  183. <ul>
  184. <li>
  185. Read the <A href="separate_compilation.html">guidelines for libraries with
  186. separate source</A>
  187. to see how to ensure that compiled link libraries meet user expectations.
  188. </li>
  189. </ul>
  190. <ul>
  191. <LI>
  192. Use the naming conventions of the C++ Standard Library (See <a href="#Naming">Naming
  193. conventions rationale</a>):
  194. <br>
  195. &nbsp;<ul>
  196. <li>
  197. Names (except as noted below) should be all lowercase, with words separated by
  198. underscores.
  199. <li>
  200. Acronyms should be treated as ordinary names (e.g. <code>xml_parser</code> instead
  201. of <code>XML_parser</code>).
  202. <li>
  203. Template parameter names begin with an uppercase letter.
  204. <li>
  205. Macro (gasp!) names all uppercase and begin with BOOST_.</li>
  206. </ul>
  207. </LI>
  208. </ul>
  209. <ul>
  210. <li>
  211. Choose meaningful names - explicit is better than implicit, and readability
  212. counts. There is a strong preference for clear and descriptive names, even if
  213. lengthy.</li>
  214. </ul>
  215. <ul>
  216. <li>
  217. Use exceptions to report errors where appropriate, and write code that is safe
  218. in the face of exceptions.</li>
  219. </ul>
  220. <ul>
  221. <li>
  222. Avoid exception-specifications. See <a href="#Exception-specification">exception-specification
  223. rationale</a>.</li>
  224. </ul>
  225. <ul>
  226. <li>
  227. Provide sample programs or confidence tests so potential users can see how to
  228. use your library.</li>
  229. </ul>
  230. <ul>
  231. <li>
  232. Provide a regression test program or programs which follow the <a href="test_policy.htm">
  233. Test Policies and Protocols</a>.</li>
  234. </ul>
  235. <ul>
  236. <li>
  237. Although some boost members use proportional fonts, tabs, and unrestricted line
  238. lengths in their own code, boost's widely distributed source code should follow
  239. more conservative guidelines:
  240. <ul>
  241. <li>
  242. Use fixed-width fonts.&nbsp; See <a href="#code_fonts">fonts rationale</a>.
  243. <li>
  244. Use spaces rather than tabs. See <a href="#Tabs">tabs rationale</a>.
  245. <li>
  246. Limit line lengths to 80 characters.</li>
  247. </ul>
  248. </li>
  249. </ul>
  250. <ul>
  251. <li>
  252. End all documentation files (HTML or otherwise) with a copyright message and a
  253. licensing message. See the <a href="#Copyright">end of this file</a> for an
  254. example of the preferred form.</li>
  255. </ul>
  256. <ul>
  257. <li>
  258. Begin all source files (including programs, headers, scripts, etc.) with:
  259. <br>
  260. &nbsp;<ul>
  261. <li>
  262. A comment line describing the contents of the file.<br>
  263. &nbsp;
  264. <li>
  265. Comments describing copyright and licensing. The preferred form is:<br>
  266. <br>
  267. <code>//&nbsp; Copyright Jane Programmer 2002. Use, modification, and distribution
  268. are<br>
  269. //&nbsp; subject to the Boost Software License, Version 1.0. (See accompanying<br>
  270. //&nbsp; file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)<br>
  271. </code>
  272. <br>
  273. Please leave an empty line before and after the copyright and license comments.
  274. It is fine if the copyright and license messages are on different lines, but
  275. there should be no other intervening text. Do not include "All rights reserved"
  276. in the copyright message.<br>
  277. <br>
  278. See <a href="license_info.html">license information page</a> for more
  279. information about the Boost Software License.<br>
  280. <br>
  281. Note that developers should not include a copy of <code>LICENSE_1_0.txt</code> in
  282. their libraries; Boost distributions already include a copy in the Boost root
  283. directory.<br>
  284. &nbsp;
  285. <li>
  286. A comment line referencing your library on the Boost web site. For example:<br>
  287. <br>
  288. <code>//&nbsp; See http://www.boost.org/libs/foo for library home page.</code><br>
  289. <br>
  290. where <code>foo</code> is the directory name (see below) for your library. As
  291. well as aiding users who come across a Boost file detached from its
  292. documentation, some of Boost's automatic tools depend on this comment to
  293. identify which library header files belong to.</li>
  294. </ul>
  295. </li>
  296. </ul>
  297. <ul>
  298. <li>
  299. Make sure your code compiles in the presence of the <code>min()</code> and <code>max()</code>
  300. macros. Some platform headers define <code>min()</code> and <code>max()</code> macros which
  301. cause some common C++ constructs to fail to compile. Some simple tricks can protect your code
  302. from inappropriate macro substitution:<br>&nbsp;
  303. <ul>
  304. <li>
  305. If you want to call <code>std::min()</code> or <code>std::max()</code>:<br>&nbsp;
  306. <ul>
  307. <li>
  308. Use <code>(std::min)(a,b)</code> if you do not require argument-dependent
  309. look-up.</li>&nbsp;
  310. <li>
  311. Use <code>boost::std_min(a,b)</code> if you do require argument-dependent look-up.
  312. <code>boost::std_min()</code> delegates to <code>std::min()</code>.</li>&nbsp;
  313. </ul>
  314. </li>
  315. <li>
  316. If you want to call <code>std::numeric_limits&lt;int&gt;::max()</code>, use
  317. <code>(std::numeric_limits&lt;int&gt;::max)()</code> instead.<br>&nbsp;
  318. </li>
  319. <li>
  320. If you want to call a <code>min()</code> or <code>max()</code> member function,
  321. instead to doing <code>obj.min()</code>, use <code>(obj.min)()</code>.<br>&nbsp;
  322. </li>
  323. <li>
  324. If you want to declare or define a function or a member function named <code>min</code>
  325. or <code>max</code>, then you must use the <code>BOOST_PREVENT_MACRO_SUBSTITUTION</code>
  326. macro. Instead of writing <code>int min() { return 0; }</code> you should write
  327. <code>int min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }</code>This is true
  328. regardless if the function is a free (namespace scope) function, a member function or a
  329. static member function, and it applies for the function declaration as well as the
  330. function definition.<br>&nbsp;
  331. </li>
  332. </ul>
  333. </li>
  334. </ul>
  335. <h3><a name="Directory_structure">Directory Structure</a> and Filenames</h3>
  336. <ul>
  337. <li>
  338. File and directory names must contain only lowercase ASCII letters , numbers,
  339. underscores, and a period.&nbsp; Leading character must be alphabetic. Maximum
  340. length 31. Only a single period is permitted.&nbsp; These requirements ensure
  341. file and directory names are relatively portable.
  342. <li>
  343. All libraries have at their highest level a primary directory named for the
  344. particular library. See <a href="#Naming&shy;_consistency">Naming consistency</a>.
  345. The primary directory may have sub-directories.
  346. <li>
  347. For very simple libraries implemented entirely within the library header, all
  348. files go in the primary directory (except headers, which go in the boost header
  349. directory).</li>
  350. </ul>
  351. <blockquote>
  352. <p><b>Boost standard sub-directory names</b></p>
  353. <table border="1" cellpadding="5">
  354. <tr>
  355. <td><b>Sub-directory</b></td>
  356. <td><b>Contents</b></td>
  357. <td><b>Required</b></td>
  358. </tr>
  359. <tr>
  360. <td><code>build</code></td>
  361. <td>Library build files such as a Jamfile.</td>
  362. <td>If any build files.</td>
  363. </tr>
  364. <tr>
  365. <td>doc</td>
  366. <td>Documentation (HTML) files.</td>
  367. <td>If several doc files.</td>
  368. </tr>
  369. <tr>
  370. <td><code>example</code></td>
  371. <td>Sample program files.</td>
  372. <td>If several sample files.</td>
  373. </tr>
  374. <tr>
  375. <td><code>src</code></td>
  376. <td>Source files which must be compiled to build the library.&nbsp;</td>
  377. <td>If any source files.</td>
  378. </tr>
  379. <tr>
  380. <td><code>test</code></td>
  381. <td>Regression or other test programs or scripts.</td>
  382. <td>If several test files.</td>
  383. </tr>
  384. </table>
  385. </blockquote>
  386. <h4><a name="Redirection">Redirection</a></h4>
  387. <p>The primary directory should always contain a file named index.html (or
  388. index.htm). Authors have requested this so that they can publish URL's in the
  389. form <i>http://www.boost.org/libs/lib-name</i> with the assurance a
  390. documentation reorganization won't invalidate the URL. Boost's internal tools
  391. are also simplified by knowing that a library's documentation is always
  392. reachable via the simplified URL.</p>
  393. <p>If the documentation is in a doc sub-directory, the primary directory
  394. index.html file should just do an automatic redirection to the doc
  395. subdirectory:</p>
  396. <blockquote>
  397. <pre>&lt;html&gt;
  398. &lt;head&gt;
  399. &lt;meta http-equiv="refresh" content="0; URL=doc/index.html"&gt;
  400. &lt;/head&gt;
  401. &lt;body&gt;
  402. Automatic redirection failed, please go to
  403. &lt;a href="doc/index.html"&gt;doc/index.html&lt;/a&gt;
  404. &lt;/body&gt;
  405. &lt;/html&gt;</pre>
  406. </blockquote>
  407. <h3><a name="Naming&shy;_consistency">Naming consistency</a></h3>
  408. <p>As library developers and users have gained experience with Boost, the
  409. following consistent naming approach has come to be viewed as very helpful,
  410. particularly for larger libraries which need their own header subdirectories
  411. and namespaces.</p>
  412. <p>Here is how it works. The library is given a name which describes the contents
  413. of the library.&nbsp; Cryptic abbreviations are not acceptable. Following the
  414. practice of the C++ Standard Library, names are usually singular rather than
  415. plural.&nbsp; For example, a library dealing with file systems might chose the
  416. name "filesystem", but not "filesystems", "fs" or "nicecode".</p>
  417. <ul>
  418. <li>
  419. The library's primary directory (in parent <i>boost-root/libs</i>) is given
  420. that same name.&nbsp; For example, <i>boost-root/libs/filesystem</i>.<br>
  421. &nbsp;
  422. <li>
  423. The library's primary header directory (in parent <i>boost-root/boost</i>) is
  424. given that same name. For example, <i>boost-root/boost/filesystem</i>.<br>
  425. &nbsp;
  426. <li>
  427. The library's primary namespace (in parent <i>::boost</i>) is given that same
  428. name. For example, <i>::boost::filesystem</i>.</li>
  429. </ul>
  430. <h3><a name="Documentation">Documentation</a></h3>
  431. <p>Even the simplest library needs some documentation; the amount should be
  432. proportional to the need.&nbsp; The documentation should assume the readers
  433. have a basic knowledge of C++, but are not necessarily experts.</p>
  434. <p>The format for documentation should be HTML, and should not require an advanced
  435. browser or server-side extensions. Style sheets are acceptable.
  436. ECMAScript/JavaScript is not acceptable. The documentation entry point should
  437. always be a file named index.html or index.htm; see <a href="#Redirection">Redirection</a>.</p>
  438. <p>There is no single right way to do documentation. HTML documentation is often
  439. organized quite differently from traditional printed documents. Task-oriented
  440. styles differ from reference oriented styles. In the end, it comes down to the
  441. question: Is the documentation sufficient for the mythical "average" C++
  442. programmer to use the library successfully?</p>
  443. <p>Appropriate topics for documentation often include:
  444. <ul>
  445. <li>
  446. General introduction to the library.
  447. <li>
  448. Description of each class.
  449. <li>
  450. Relationship between classes.
  451. <li>
  452. For each function, as applicable, description, requirements (preconditions),
  453. effects, post-conditions, returns, and throws.
  454. <li>
  455. Discussion of error detection and recovery strategy.
  456. <li>
  457. How to use including description of typical uses.
  458. <li>
  459. How to compile and link.
  460. <li>
  461. How to test.
  462. <li>
  463. Version or revision history.
  464. <li>
  465. Rationale for design decisions.&nbsp; See <a href="#Rationale">Rationale rationale</a>.
  466. <li>
  467. Acknowledgements.&nbsp; See <a href="#Acknowledgements">Acknowledgments rationale.</a></li>
  468. </ul>
  469. <p>If you need more help with how to write documentation you can check out the
  470. article on <a href="writingdoc/index.html">Writing Documentation for Boost</a>.</p>
  471. <h2><a name="Rationale">Rationale</a></h2>
  472. <p>Rationale for some of the requirements and guidelines follows.</p>
  473. <hr>
  474. <h3><a name="Exception-specification">Exception-specification</a> rationale</h3>
  475. <p>Exception specifications [ISO 15.4] are sometimes coded to indicate what
  476. exceptions may be thrown, or because the programmer hopes they will improved
  477. performance.&nbsp; But consider the following member from a smart pointer:</p>
  478. <pre> T&amp; operator*() const throw() { return *ptr; }</pre>
  479. <p>This function calls no other functions; it only manipulates fundamental data
  480. types like pointers Therefore, no runtime behavior of the
  481. exception-specification can ever be invoked.&nbsp; The function is completely
  482. exposed to the compiler; indeed it is declared inline Therefore, a smart
  483. compiler can easily deduce that the functions are incapable of throwing
  484. exceptions, and make the same optimizations it would have made based on the
  485. empty exception-specification. A "dumb" compiler, however, may make all kinds
  486. of pessimizations.</p>
  487. <p>For example, some compilers turn off inlining if there is an
  488. exception-specification.&nbsp; Some compilers add try/catch blocks. Such
  489. pessimizations can be a performance disaster which makes the code unusable in
  490. practical applications.</p>
  491. <p>Although initially appealing, an exception-specification tends to have
  492. consequences that require <b>very</b> careful thought to understand. The
  493. biggest problem with exception-specifications is that programmers use them as
  494. though they have the effect the programmer would like, instead of the effect
  495. they actually have.</p>
  496. <p>A non-inline function is the one place a "throws nothing"
  497. exception-specification may have some benefit with some compilers.</p>
  498. <hr>
  499. <h3><a name="Naming">Naming</a> conventions rationale</h3>
  500. <p>The C++ standard committee's Library Working Group discussed this issue in
  501. detail, and over a long period of time. The discussion was repeated again in
  502. early boost postings. A short summary:</p>
  503. <ul>
  504. <li>
  505. Naming conventions are contentious, and although several are widely used, no
  506. one style predominates.
  507. <li>
  508. Given the intent to propose portions of boost for the next revision of the C++
  509. standard library, boost decided to follow the standard library's conventions.
  510. <li>
  511. Once a library settles on a particular convention, a vast majority of
  512. stakeholders want that style to be consistently used.
  513. </li>
  514. </ul>
  515. <hr>
  516. <h3>Source <a name="code_fonts">code fonts</a> rationale</h3>
  517. <p>Dave Abrahams comments: An important purpose (I daresay the primary purpose) of
  518. source code is communication: the documentation of intent. This is a doubly
  519. important goal for boost, I think. Using a fixed-width font allows us to
  520. communicate with more people, in more ways (diagrams are possible) right there
  521. in the source. Code written for fixed-width fonts using spaces will read
  522. reasonably well when viewed with a variable-width font, and as far as I can
  523. tell every editor supporting variable-width fonts also supports fixed width. I
  524. don't think the converse is true.</p>
  525. <hr>
  526. <h3><a name="Tabs">Tabs</a> rationale</h3>
  527. <p>Tabs are banned because of the practical problems caused by tabs in
  528. multi-developer projects like Boost, rather than any dislike in principle. See <a href="mailing_lists.htm#archive">
  529. mailing list archives</a>. Problems include maintenance of a single source
  530. file by programmers using tabs and programmers using spaces, and the difficulty
  531. of enforcing a consistent tab policy other than just "no tabs". Discussions
  532. concluded that Boost files should either all use tabs, or all use spaces, and
  533. thus the decision to stick with spaces.</p>
  534. <hr>
  535. <h3>ECMAScript/<a name="JavaScript">JavaScript</a> rationale</h3>
  536. <p>Before the 1.29.0 release, two Boost libraries added ECMAScript/JavaScript
  537. documentation. Controversy followed (see <a href="mailing_lists.htm#archive">mailing
  538. list archives</a>), and the developers were asked to remove the
  539. ECMAScript/JavaScript. Reasons given for banning included:</p>
  540. <ul>
  541. <li>
  542. Incompatible with some older browsers and some text based browsers.
  543. <li>
  544. Makes printing docs pages difficult.
  545. <li>
  546. Often results in really bad user interface design.
  547. <li>
  548. "It's just annoying in general."
  549. <li>
  550. Would require Boost to test web pages for ECMAScript/JavaScript compliance.
  551. <li>
  552. Makes docs maintenance by other than the original developer more difficult.</li>
  553. </ul>
  554. <hr>
  555. <h3><a name="Rationale_rationale">Rationale rationale</a></h3>
  556. <p>Rationale is defined as "The fundamental reasons for something; basis" by the
  557. American Heritage Dictionary.</p>
  558. <p>Beman Dawes comments:&nbsp; Failure to supply contemporaneous rationale for
  559. design decisions is a major defect in many software projects. Lack of accurate
  560. rationale causes issues to be revisited endlessly, causes maintenance bugs when
  561. a maintainer changes something without realizing it was done a certain way for
  562. some purpose, and shortens the useful lifetime of software.</p>
  563. <p>Rationale is fairly easy to provide at the time decisions are made, but very
  564. hard to accurately recover even a short time later.</p>
  565. <hr>
  566. <h3><a name="Acknowledgements">Acknowledgements</a> rationale</h3>
  567. <p>As a library matures, it almost always accumulates improvements suggested to
  568. the authors by other boost members.&nbsp; It is a part of the culture of
  569. boost.org to acknowledge such contributions, identifying the person making the
  570. suggestion.&nbsp; Major contributions are usually acknowledged in the
  571. documentation, while minor fixes are often mentioned in comments within the
  572. code itself.</p>
  573. <hr>
  574. <p>Revised
  575. <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->
  576. 04 November, 2003<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
  577. <p>
  578. © <a name="Copyright">Copyright</a> Beman Dawes 2003.</p>
  579. <p>
  580. Use, modification, and distribution are subject to the Boost Software License,
  581. Version 1.0. (See accompanying file <a href="../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
  582. or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
  583. </body>
  584. </html>
粤ICP备19079148号