File: Header-Rules.txt

package info (click to toggle)
libsmbios 2.0.3.dfsg-1.1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 3,768 kB
  • ctags: 2,016
  • sloc: cpp: 14,292; sh: 9,408; xml: 3,820; makefile: 454; ansic: 402; python: 157
file content (63 lines) | stat: -rw-r--r-- 1,890 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=txt:

/** \page header_rules Rules for header file inclusion

 - Header files should always successfully compile standalone. Use the "make
   header_file_check" makefile target to test this.

 - Header files in include/smbios should only include other headers in include/
   or system headers.

 - Header files should _never_ include a "using namespace" directive.

 - if "file.h" is in our source tree use "file.h" like this:
 \verbatim #include "file.h" \endverbatim 
 - all other header files use <file.h>, like this:
 \verbatim #include <file.h> \endverbatim

 - Always use 'C'-style comments in header files: \/* ... *\/

 - header file order in HEADER files
    - Always include "smbios/compat.h" first.
    - Include system includes next
    - Include "smbios/types.h" next, if necessary
    - include any "I*.h" interface headers next
    - include any other includes

 - header file order in C++ code  
    - If you have _any_ system includes, include "smbios/compat.h" first
    - Include system includes next, if necessary
    - Should _rarely_ have to include "types.h", should be in a header already.
    - Include any "I*.h" interface headers next
    - all others


Here is an example header file:

\verbatim
// standard include guard... prevent multiple inclusion
#ifndef SMBIOSINTERFACE_H
#define SMBIOSINTERFACE_H

// compat header should always be first header
#include "smbios/compat.h"

// next include system header files
#include <cstdlib>		// Provides size_t and NULL
#include <iostream>
#include <string>
#include <map>
#include <memory>       // Provides auto_ptr<>

// types.h should be first user-defined header.
#include "smbios/types.h"  

// include other smbios/I*.h headers next
#include "smbios/IFactory.h"

     //....  declarations here ....

#endif /* SMBIOSINTERFACE_H */
\endverbatim
   
*/