3 <title>libsm : C Language Portability Macros
</title>
7 <a href=
"index.html">Back to libsm overview
</a>
10 <h1> libsm : C Language Portability Macros
</h1>
11 <br> $Id: cdefs.html,v
1.2 2000/
12/
07 17:
33:
09 dmoen Exp $
14 <h2> Description
</h2>
16 The header file
<tt><sm/cdefs.h
></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
24 <tt> __P(parameterlist)
</tt>
26 This macro is used to write portable function prototypes.
34 <tt> __CONCAT(x,y)
</tt>
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.
42 <tt> __STRING(x)
</tt>
44 This macro converts the token sequence x into a string literal.
48 <tt> __BEGIN_DECLS, __END_DECLS
</tt>
50 These macros are used to write C header files that are compatible
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
59 <tt> const, signed, volatile
</tt>
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
68 <tt> SM_DEAD(function_declaration)
</tt>
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.
77 SM_DEAD(void exit __P((int)));
81 <tt> SM_UNUSED(variable_declaration)
</tt>
83 This macro modifies a definition of an unused
84 local variable, global variable or function parameter
85 in order to suppress compiler warnings.
89 SM_UNUSED(static const char Id[]) =
"@(#)$Id: cdefs.html,v 1.2 2000/12/07 17:33:09 dmoen Exp $";