| 19 | | * The license must meet the [#License license requirements] |
| 20 | | below. Restricted licenses like the GPL and |
| 21 | | LGPL are not acceptable. |
| 22 | | * The copyright [#Ownership ownership] must be |
| 23 | | clear. |
| 24 | | * The library must be generally useful and not restricted |
| 25 | | to a narrow problem domain. |
| 26 | | * The library must meet the [#Portability portability requirements] below. |
| 27 | | * The library must come reasonably close to meeting the |
| 28 | | [#Guidelines Guidelines] below. |
| 29 | | * [#Design_and_Programming Design and Programming] |
| 30 | | * [#Directory_structure Directory Structure] |
| 31 | | * [#Documentation Documentation] |
| 32 | | * The author must be willing to participate in discussions |
| 33 | | on the mailing list, and to refine the library |
| 34 | | accordingly. |
| | 19 | * The license must meet the [#License license requirements] |
| | 20 | below. Restricted licenses like the GPL and |
| | 21 | LGPL are not acceptable. |
| | 22 | * The copyright [#Ownership ownership] must be |
| | 23 | clear. |
| | 24 | * The library must be generally useful and not restricted |
| | 25 | to a narrow problem domain. |
| | 26 | * The library must meet the [#Portability portability requirements] below. |
| | 27 | * The library must come reasonably close to meeting the |
| | 28 | [#Guidelines Guidelines] below. |
| | 29 | * [#Design_and_Programming Design and Programming] |
| | 30 | * [#Directory_structure Directory Structure] |
| | 31 | * [#Documentation Documentation] |
| | 32 | * The author must be willing to participate in discussions |
| | 33 | on the mailing list, and to refine the library |
| | 34 | accordingly. |
| 53 | | * Must be simple to read and understand. |
| 54 | | * Must grant permission without fee to copy, use and modify |
| 55 | | the software for any use (commercial and |
| 56 | | non-commercial). |
| 57 | | * Must require that the license appear on all copies of the |
| 58 | | software source code. |
| 59 | | * Must not require that the license appear with executables |
| 60 | | or other binary uses of the library. |
| 61 | | * Must not require that the source code be available for |
| 62 | | execution or other binary uses of the library. |
| 63 | | * May restrict the use of the name and description of the |
| 64 | | library to the standard version found on the Boost web |
| 65 | | site. |
| | 53 | * Must be simple to read and understand. |
| | 54 | * Must grant permission without fee to copy, use and modify |
| | 55 | the software for any use (commercial and |
| | 56 | non-commercial). |
| | 57 | * Must require that the license appear on all copies of the |
| | 58 | software source code. |
| | 59 | * Must not require that the license appear with executables |
| | 60 | or other binary uses of the library. |
| | 61 | * Must not require that the source code be available for |
| | 62 | execution or other binary uses of the library. |
| | 63 | * May restrict the use of the name and description of the |
| | 64 | library to the standard version found on the Boost web |
| | 65 | site. |
| 69 | | * A library's interface must portable and not restricted to |
| 70 | | a particular compiler or operating system. |
| 71 | | * A library's implementation must if possible be portable |
| 72 | | and not restricted to a particular compiler or operating |
| 73 | | system. If a portable implementation is not possible, |
| 74 | | non-portable constructions are acceptable if reasonably easy |
| 75 | | to port to other environments, and implementations are |
| 76 | | provided for at least two popular operating systems (such as |
| 77 | | UNIX and Windows). |
| 78 | | * There is no requirement that a library run on C++ |
| 79 | | compilers which do not conform to the ISO standard. |
| 80 | | * There is no requirement that a library run on any |
| 81 | | particular C++ compiler. Boost contributors often try to |
| 82 | | ensure their libraries work with popular compilers. The |
| 83 | | boost/config.hpp |
| 84 | | [http://www.boost.org/doc/libs/release/libs/config/config.htm configuration header] |
| 85 | | is the preferred mechanism for working around |
| 86 | | compiler deficiencies. |
| | 69 | * A library's interface must portable and not restricted to |
| | 70 | a particular compiler or operating system. |
| | 71 | * A library's implementation must if possible be portable |
| | 72 | and not restricted to a particular compiler or operating |
| | 73 | system. If a portable implementation is not possible, |
| | 74 | non-portable constructions are acceptable if reasonably easy |
| | 75 | to port to other environments, and implementations are |
| | 76 | provided for at least two popular operating systems (such as |
| | 77 | UNIX and Windows). |
| | 78 | * There is no requirement that a library run on C++ |
| | 79 | compilers which do not conform to the ISO standard. |
| | 80 | * There is no requirement that a library run on any |
| | 81 | particular C++ compiler. Boost contributors often try to |
| | 82 | ensure their libraries work with popular compilers. The |
| | 83 | boost/config.hpp |
| | 84 | [http://www.boost.org/doc/libs/release/libs/config/config.htm configuration header] |
| | 85 | is the preferred mechanism for working around |
| | 86 | compiler deficiencies. |
| 152 | | * Names (except as noted below) should be all lowercase, |
| 153 | | with words separated by underscores. |
| 154 | | * Acronyms should be treated as ordinary names (e.g. |
| 155 | | `xml_parser` instead of |
| 156 | | `XML_parser`). |
| 157 | | * Template parameter names begin with an uppercase |
| 158 | | letter. |
| 159 | | * Macro (gasp!) names all uppercase and begin with |
| 160 | | `BOOST_`. |
| | 151 | * Names (except as noted below) should be all lowercase, |
| | 152 | with words separated by underscores. |
| | 153 | * Acronyms should be treated as ordinary names (e.g. |
| | 154 | `xml_parser` instead of |
| | 155 | `XML_parser`). |
| | 156 | * Template parameter names begin with an uppercase |
| | 157 | letter. |
| | 158 | * Macro (gasp!) names all uppercase and begin with `BOOST_`. |
| 195 | | * A comment line describing the contents of the file. |
| 196 | | * Comments describing copyright and licensing: again, the |
| 197 | | preferred form is indicated in the |
| 198 | | [http://www.boost.org/users/license.html license information] page |
| 199 | | * Note that developers should not provide a copy of |
| 200 | | `LICENSE_1_0.txt` with their libraries: Boost |
| 201 | | distributions already include a copy in the Boost root |
| 202 | | directory. |
| 203 | | * A comment line referencing your library on the Boost web |
| 204 | | site. For example: |
| 205 | | |
| 206 | | // See http://www.boost.org/libs/foo for library home page. |
| 207 | | |
| 208 | | Where `foo` is the directory name (see below) |
| 209 | | for the library. As well as aiding users who come across a |
| 210 | | Boost file detached from its documentation, some of Boost's |
| 211 | | automatic tools depend on this comment to identify which |
| 212 | | library header files belong to. |
| | 193 | * A comment line describing the contents of the file. |
| | 194 | * Comments describing copyright and licensing: again, the |
| | 195 | preferred form is indicated in the |
| | 196 | [http://www.boost.org/users/license.html license information] page |
| | 197 | * Note that developers should not provide a copy of |
| | 198 | `LICENSE_1_0.txt` with their libraries: Boost |
| | 199 | distributions already include a copy in the Boost root |
| | 200 | directory. |
| | 201 | * A comment line referencing your library on the Boost web |
| | 202 | site. For example: |
| | 203 | {{{ |
| | 204 | // See http://www.boost.org/libs/foo for library home page. |
| | 205 | }}} |
| | 206 | Where `foo` is the directory name (see below) |
| | 207 | for the library. As well as aiding users who come across a |
| | 208 | Boost file detached from its documentation, some of Boost's |
| | 209 | automatic tools depend on this comment to identify which |
| | 210 | library header files belong to. |
| 221 | | * If you want to call `std::min()` or |
| 222 | | `std::max()`: |
| 223 | | * If you do not require argument-dependent look-up, use |
| 224 | | `(std::min)(a,b)`. |
| 225 | | * If you do require argument-dependent look-up, you |
| 226 | | should: |
| 227 | | * `#include <boost/config.hpp>` |
| 228 | | * Use `BOOST_USING_STD_MIN();` to bring |
| 229 | | `std::min()` into the current scope. |
| 230 | | * Use `min BOOST_PREVENT_MACRO_SUBSTITUTION |
| 231 | | (a,b);` to make an argument-dependent call to |
| 232 | | `min(a,b)`. |
| 233 | | * If you want to call |
| 234 | | `std::numeric_limits<int>::max()`, use |
| 235 | | `(std::numeric_limits<int>::max)()` |
| 236 | | instead. |
| 237 | | * If you want to call a `min()` or |
| 238 | | `max()` member function, instead to doing |
| 239 | | `obj.min()`, use `(obj.min)()`. |
| 240 | | * If you want to declare or define a function or a member |
| 241 | | function named `min` or `max`, then you |
| 242 | | must use the `BOOST_PREVENT_MACRO_SUBSTITUTION` |
| 243 | | macro. Instead of writing `int min() { return 0; |
| 244 | | }` you should write `int min |
| 245 | | BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }` This |
| 246 | | is true regardless if the function is a free (namespace |
| 247 | | scope) function, a member function or a static member |
| 248 | | function, and it applies for the function declaration as well |
| 249 | | as for the function definition. |
| | 219 | * If you want to call `std::min()` or |
| | 220 | `std::max()`: |
| | 221 | * If you do not require argument-dependent look-up, use |
| | 222 | `(std::min)(a,b)`. |
| | 223 | * If you do require argument-dependent look-up, you should: |
| | 224 | * `#include <boost/config.hpp>` |
| | 225 | * Use `BOOST_USING_STD_MIN();` to bring |
| | 226 | `std::min()` into the current scope. |
| | 227 | * Use `min BOOST_PREVENT_MACRO_SUBSTITUTION |
| | 228 | (a,b);` to make an argument-dependent call to `min(a,b)`. |
| | 229 | * If you want to call |
| | 230 | `std::numeric_limits<int>::max()`, use |
| | 231 | `(std::numeric_limits<int>::max)()` |
| | 232 | instead. |
| | 233 | * If you want to call a `min()` or |
| | 234 | `max()` member function, instead to doing |
| | 235 | `obj.min()`, use `(obj.min)()`. |
| | 236 | * If you want to declare or define a function or a member |
| | 237 | function named `min` or `max`, then you |
| | 238 | must use the `BOOST_PREVENT_MACRO_SUBSTITUTION` |
| | 239 | macro. Instead of writing `int min() { return 0; }` |
| | 240 | you should write |
| | 241 | `int min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }` |
| | 242 | This is true regardless if the function is a free (namespace |
| | 243 | scope) function, a member function or a static member |
| | 244 | function, and it applies for the function declaration as well |
| | 245 | as for the function definition. |
| 259 | | * Names must contain only |
| 260 | | '''lowercase'''^[#Filename_rationale_1 1]^ ASCII letters |
| 261 | | (`'a'`-`'z'`), numbers |
| 262 | | (`'0'`-`'9'`), underscores |
| 263 | | (`'_'`), hyphens (`'-'`), and periods |
| 264 | | (`'.'`). Spaces are not allowed^[#Filename_rationale_2 2]^. |
| 265 | | * Directory names must not contain periods |
| 266 | | (`'.'`)^[#Filename_Rationale_3 3]^. |
| 267 | | * The first and last character of a file name must not be a |
| 268 | | period (`'.'`)^[#Filename_rationale_4 4]^. |
| 269 | | * The first character of names must not be a hyphen |
| 270 | | (`'-'`)^[#Filename_rationale_5 5]^. |
| 271 | | * The maximum length of directory and file names is 31 |
| 272 | | characters^[#Filename_rationale_6 6]^. |
| 273 | | * The total path length must not exceed 207 |
| 274 | | characters^[#Filename_rationale_7 7]^. |
| | 255 | * Names must contain only |
| | 256 | '''lowercase'''^[#Filename_rationale_1 1]^ ASCII letters |
| | 257 | (`'a'`-`'z'`), numbers |
| | 258 | (`'0'`-`'9'`), underscores |
| | 259 | (`'_'`), hyphens (`'-'`), and periods |
| | 260 | (`'.'`). Spaces are not allowed^[#Filename_rationale_2 2]^. |
| | 261 | * Directory names must not contain periods |
| | 262 | (`'.'`)^[#Filename_Rationale_3 3]^. |
| | 263 | * The first and last character of a file name must not be a |
| | 264 | period (`'.'`)^[#Filename_rationale_4 4]^. |
| | 265 | * The first character of names must not be a hyphen |
| | 266 | (`'-'`)^[#Filename_rationale_5 5]^. |
| | 267 | * The maximum length of directory and file names is 31 |
| | 268 | characters^[#Filename_rationale_6 6]^. |
| | 269 | * The total path length must not exceed 207 |
| | 270 | characters^[#Filename_rationale_7 7]^. |
| 278 | | * Files intended to be processed by a C++ compiler as part |
| 279 | | of a translation unit should have '''a three-letter |
| 280 | | filename extension ending in "pp"'''. Other files |
| 281 | | should ''not'' use extensions ending in "pp". This |
| 282 | | convention makes it easy to identify all of the C++ source in |
| 283 | | Boost. |
| 284 | | * All libraries have at their highest level a primary |
| 285 | | directory named for the particular library. See |
| 286 | | [#Naming_consistency Naming consistency]. The primary |
| 287 | | directory may have sub-directories. |
| 288 | | * For very simple libraries implemented entirely within the |
| 289 | | library header, all files go in the primary directory (except |
| 290 | | headers, which go in the boost header directory). |
| | 274 | * Files intended to be processed by a C++ compiler as part |
| | 275 | of a translation unit should have '''a three-letter |
| | 276 | filename extension ending in "pp"'''. Other files |
| | 277 | should ''not'' use extensions ending in "pp". This |
| | 278 | convention makes it easy to identify all of the C++ source in |
| | 279 | Boost. |
| | 280 | * All libraries have at their highest level a primary |
| | 281 | directory named for the particular library. See |
| | 282 | [#Naming_consistency Naming consistency]. The primary |
| | 283 | directory may have sub-directories. |
| | 284 | * For very simple libraries implemented entirely within the |
| | 285 | library header, all files go in the primary directory (except |
| | 286 | headers, which go in the boost header directory). |
| 350 | | * The library's primary directory (in parent |
| 351 | | ''boost-root/libs'') is given that same name. For |
| 352 | | example, ''boost-root/libs/filesystem''. |
| 353 | | * The library's primary header directory (in parent |
| 354 | | ''boost-root/boost'') is given that same name. For |
| 355 | | example, ''boost-root/boost/filesystem''. |
| 356 | | * The library's primary namespace (in parent |
| 357 | | ''::boost'') is given that same name, except when |
| 358 | | there's a component with that name (e.g., |
| 359 | | ''boost::tuple''), in which case the namespace name is |
| 360 | | pluralized. For example, ''::boost::filesystem''. |
| | 346 | * The library's primary directory (in parent |
| | 347 | ''boost-root/libs'') is given that same name. For |
| | 348 | example, ''boost-root/libs/filesystem''. |
| | 349 | * The library's primary header directory (in parent |
| | 350 | ''boost-root/boost'') is given that same name. For |
| | 351 | example, ''boost-root/boost/filesystem''. |
| | 352 | * The library's primary namespace (in parent |
| | 353 | ''::boost'') is given that same name, except when |
| | 354 | there's a component with that name (e.g., |
| | 355 | ''boost::tuple''), in which case the namespace name is |
| | 356 | pluralized. For example, ''::boost::filesystem''. |
| 365 | | * The library name is set in roman type. |
| 366 | | * The library name is capitalized. |
| 367 | | * A period between "Boost" and the library name (e.g., |
| 368 | | Boost.Bind) is used if and only if the library name is not |
| 369 | | followed by the word "library". |
| 370 | | * The word "library" is not part of the library name and is |
| 371 | | therefore lowercased. |
| | 361 | * The library name is set in roman type. |
| | 362 | * The library name is capitalized. |
| | 363 | * A period between "Boost" and the library name (e.g., |
| | 364 | Boost.Bind) is used if and only if the library name is not |
| | 365 | followed by the word "library". |
| | 366 | * The word "library" is not part of the library name and is |
| | 367 | therefore lowercased. |
| 402 | | * General introduction to the library. The introduction |
| 403 | | particularly needs to include: |
| 404 | | * A very high-level overview of what the library is |
| 405 | | good for, and perhaps what it isn't good for, |
| 406 | | understandable even by those with no prior knowledge of |
| 407 | | the problem domain. |
| 408 | | * The simplest possible ("hello world") example of |
| 409 | | using the library. |
| 410 | | * Tutorial covering basic use cases. |
| 411 | | * Reference documentation: |
| 412 | | * Description of each class. |
| 413 | | * Relationship between classes. |
| 414 | | * For each function, as applicable, description, |
| 415 | | requirements (preconditions), effects, post-conditions, |
| 416 | | returns, and throws. |
| 417 | | * Discussion of error detection and recovery |
| 418 | | strategy. |
| 419 | | * How to compile and link. |
| 420 | | * How to test. |
| 421 | | * Version or revision history. |
| 422 | | * Rationale for design decisions. See [#Rationale Rationale rationale]. |
| 423 | | * Acknowledgements. See [#Acknowledgements Acknowledgments rationale.] |
| | 398 | * General introduction to the library. The introduction |
| | 399 | particularly needs to include: |
| | 400 | * A very high-level overview of what the library is |
| | 401 | good for, and perhaps what it isn't good for, |
| | 402 | understandable even by those with no prior knowledge of |
| | 403 | the problem domain. |
| | 404 | * The simplest possible ("hello world") example of |
| | 405 | using the library. |
| | 406 | * Tutorial covering basic use cases. |
| | 407 | * Reference documentation: |
| | 408 | * Description of each class. |
| | 409 | * Relationship between classes. |
| | 410 | * For each function, as applicable, description, |
| | 411 | requirements (preconditions), effects, post-conditions, |
| | 412 | returns, and throws. |
| | 413 | * Discussion of error detection and recovery |
| | 414 | strategy. |
| | 415 | * How to compile and link. |
| | 416 | * How to test. |
| | 417 | * Version or revision history. |
| | 418 | * Rationale for design decisions. See [#Rationale Rationale rationale]. |
| | 419 | * Acknowledgements. See [#Acknowledgements Acknowledgments rationale.] |
| 477 | | * Naming conventions are contentious, and although several |
| 478 | | are widely used, no one style predominates. |
| 479 | | * Given the intent to propose portions of boost for the |
| 480 | | next revision of the C++ standard library, boost decided to |
| 481 | | follow the standard library's conventions. |
| 482 | | * Once a library settles on a particular convention, a vast |
| 483 | | majority of stakeholders want that style to be consistently |
| 484 | | used. |
| | 473 | * Naming conventions are contentious, and although several |
| | 474 | are widely used, no one style predominates. |
| | 475 | * Given the intent to propose portions of boost for the |
| | 476 | next revision of the C++ standard library, boost decided to |
| | 477 | follow the standard library's conventions. |
| | 478 | * Once a library settles on a particular convention, a vast |
| | 479 | majority of stakeholders want that style to be consistently |
| | 480 | used. |
| 513 | | 1. Some legacy file systems require |
| 514 | | single-case names. Single-case names eliminate casing mistakes |
| 515 | | when moving from case-insensitive to case-sensitive file |
| 516 | | systems. |
| 517 | | |
| 518 | | 2. This is the lowercase portion of |
| 519 | | the POSIX portable filename character set. To quote the POSIX |
| 520 | | standard, "Filenames should be constructed from the portable |
| 521 | | filename character set because the use of other characters can |
| 522 | | be confusing or ambiguous in certain contexts." |
| 523 | | |
| 524 | | 3. Strict implementations of ISO |
| 525 | | 9660:1999 and some legacy operating systems prohibit dots in |
| 526 | | directory names. The need for this restriction is fading, and |
| 527 | | it will probably be removed fairly soon. |
| 528 | | |
| 529 | | 4. POSIX has special rules for names |
| 530 | | beginning with a period. Windows prohibits names ending in a |
| 531 | | period. |
| 532 | | |
| 533 | | 5. Would be too confusing or ambiguous in certain contexts. |
| 534 | | |
| 535 | | 6. We had to draw the line |
| 536 | | somewhere, and so the limit imposed by a now obsolete Apple |
| 537 | | file system was chosen years ago. It still seems a reasonable |
| 538 | | limit to aid human comprehension. |
| 539 | | |
| 540 | | 7. ISO 9660:1999. |
| | 509 | {{{ |
| | 510 | #!html |
| | 511 | <a name="Filename_rationale_1" id="Filename_rationale_1"></a> |
| | 512 | }}} |
| | 513 | 1. Some legacy file systems require |
| | 514 | single-case names. Single-case names eliminate casing mistakes |
| | 515 | when moving from case-insensitive to case-sensitive file |
| | 516 | systems. |
| | 517 | |
| | 518 | {{{ |
| | 519 | #!html |
| | 520 | <a name="Filename_rationale_2" id="Filename_rationale_2"></a> |
| | 521 | }}} |
| | 522 | 2. This is the lowercase portion of |
| | 523 | the POSIX portable filename character set. To quote the POSIX |
| | 524 | standard, "Filenames should be constructed from the portable |
| | 525 | filename character set because the use of other characters can |
| | 526 | be confusing or ambiguous in certain contexts." |
| | 527 | |
| | 528 | {{{ |
| | 529 | #!html |
| | 530 | <a name="Filename_rationale_3" id="Filename_rationale_3"></a> |
| | 531 | }}} |
| | 532 | 3.Strict implementations of ISO |
| | 533 | 9660:1999 and some legacy operating systems prohibit dots in |
| | 534 | directory names. The need for this restriction is fading, and |
| | 535 | it will probably be removed fairly soon. |
| | 536 | |
| | 537 | {{{ |
| | 538 | #!html |
| | 539 | <a name="Filename_rationale_4" id="Filename_rationale_4"></a> |
| | 540 | }}} |
| | 541 | 4. POSIX has special rules for names |
| | 542 | beginning with a period. Windows prohibits names ending in a |
| | 543 | period. |
| | 544 | |
| | 545 | {{{ |
| | 546 | #!html |
| | 547 | <a name="Filename_rationale_5" id="Filename_rationale_5"></a> |
| | 548 | }}} |
| | 549 | 5.Would be too confusing or ambiguous in certain contexts. |
| | 550 | |
| | 551 | {{{ |
| | 552 | #!html |
| | 553 | <a name="Filename_rationale_6" id="Filename_rationale_6"></a> |
| | 554 | }}} |
| | 555 | 6.We had to draw the line |
| | 556 | somewhere, and so the limit imposed by a now obsolete Apple |
| | 557 | file system was chosen years ago. It still seems a reasonable |
| | 558 | limit to aid human comprehension. |
| | 559 | |
| | 560 | {{{ |
| | 561 | #!html |
| | 562 | <a name="Filename_rationale_7" id="Filename_rationale_7"></a> |
| | 563 | }}} |
| | 564 | 7.ISO 9660:1999. |
| 550 | | * Incompatible with some older browsers and some text based |
| 551 | | browsers. |
| 552 | | * Makes printing docs pages difficult. |
| 553 | | * Often results in really bad user interface design. |
| 554 | | * "It's just annoying in general." |
| 555 | | * Would require Boost to test web pages for |
| 556 | | ECMAScript/JavaScript compliance. |
| 557 | | * Makes docs maintenance by other than the original |
| 558 | | developer more difficult. |
| | 574 | * Incompatible with some older browsers and some text based |
| | 575 | browsers. |
| | 576 | * Makes printing docs pages difficult. |
| | 577 | * Often results in really bad user interface design. |
| | 578 | * "It's just annoying in general." |
| | 579 | * Would require Boost to test web pages for |
| | 580 | ECMAScript/JavaScript compliance. |
| | 581 | * Makes docs maintenance by other than the original |
| | 582 | developer more difficult. |