Update zoneinfo database.
[dragonfly/netmp.git] / contrib / sendmail / libsm / cdefs.html
blob33e45acfd3e625f068dda45ed20f68567961445d
1 <html>
2 <head>
3 <title>libsm : C Language Portability Macros</title>
4 </head>
5 <body>
7 <a href="index.html">Back to libsm overview</a>
9 <center>
10 <h1> libsm : C Language Portability Macros </h1>
11 <br> $Id: cdefs.html,v 1.2 2000/12/07 17:33:09 dmoen Exp $
12 </center>
14 <h2> Description </h2>
16 The header file <tt>&lt;sm/cdefs.h&gt;</tt>
17 defines portable interfaces to non-portable features
18 of various C compilers.
19 It also assists you in writing C header files that are compatible
20 with C++.
22 <dl>
23 <dt>
24 <tt> __P(parameterlist) </tt>
25 <dd>
26 This macro is used to write portable function prototypes.
27 For example,
29 <blockquote><pre>
30 int foo __P((int));
31 </pre></blockquote>
33 <dt>
34 <tt> __CONCAT(x,y) </tt>
35 <dd>
36 This macro concatenates two tokens x and y,
37 forming a single token xy.
38 Warning: make sure there is no white space around the arguments x and y.
39 <p>
41 <dt>
42 <tt> __STRING(x) </tt>
43 <dd>
44 This macro converts the token sequence x into a string literal.
45 <p>
47 <dt>
48 <tt> __BEGIN_DECLS, __END_DECLS </tt>
49 <dd>
50 These macros are used to write C header files that are compatible
51 with C++ compilers.
52 Put <tt>__BEGIN_DECLS</tt> before the first function or variable
53 declaration in your header file,
54 and put <tt>__END_DECLS</tt> after the last function or variable
55 declaration.
56 <p>
58 <dt>
59 <tt> const, signed, volatile </tt>
60 <dd>
61 For pre-ANSI C compilers, <tt>const</tt>, <tt>signed</tt>
62 and <tt>volatile</tt> are defined as empty macros.
63 This means you can use these keywords without introducing
64 portability problems.
65 <p>
67 <dt>
68 <tt> SM_DEAD(function_declaration) </tt>
69 <dd>
70 This macro modifies a prototype of a function
71 that does not return to its caller.
72 With some versions of gcc, this will result in slightly better code,
73 and can suppress some useless warnings produced by gcc -Wall.
74 For example,
76 <blockquote><pre>
77 SM_DEAD(void exit __P((int)));
78 </pre></blockquote>
80 <dt>
81 <tt> SM_UNUSED(variable_declaration) </tt>
82 <dd>
83 This macro modifies a definition of an unused
84 local variable, global variable or function parameter
85 in order to suppress compiler warnings.
86 Examples:
88 <blockquote><pre>
89 SM_UNUSED(static const char Id[]) = "@(#)$Id: cdefs.html,v 1.2 2000/12/07 17:33:09 dmoen Exp $";
90 void
91 foo(x)
92 SM_UNUSED(int x);
94 SM_UNUSED(int y) = 0;
95 return 0;
97 void
98 bar(SM_UNUSED(int x))
100 return 0;
102 </pre></blockquote>
104 </dl>
106 </body>
107 </html>