Initial revision
[platform/upstream/glib.git] / docs / reference / glib / tmpl / macros_misc.sgml
1 <!-- ##### SECTION Title ##### -->
2 Miscellaneous Macros
3
4 <!-- ##### SECTION Short_Description ##### -->
5 specialised macros which are not used often.
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 These macros provide more specialized features which are not needed so often
10 by application programmers.
11 </para>
12
13 <!-- ##### SECTION See_Also ##### -->
14 <para>
15
16 </para>
17
18 <!-- ##### MACRO G_INLINE_FUNC ##### -->
19 <para>
20 Used to declare inline functions. If inline functions are not supported on
21 the particular platform, the macro evaluates to the empty string.
22 </para>
23
24
25
26 <!-- ##### MACRO G_STMT_START ##### -->
27 <para>
28 Used within multi-statement macros so that they can be used in places where
29 only one statement is expected by the compiler.
30 </para>
31
32
33
34 <!-- ##### MACRO G_STMT_END ##### -->
35 <para>
36 Used within multi-statement macros so that they can be used in places where
37 only one statement is expected by the compiler.
38 </para>
39
40
41
42 <!-- ##### MACRO G_VA_COPY ##### -->
43 <para>
44 Portable way to copy <type>va_list</type> variables.
45 </para>
46
47 @ap1: the <type>va_list</type> variable to place a copy of @ap2 in.
48 @ap2: a <type>va_list</type>.
49
50
51 <!-- ##### MACRO G_GNUC_EXTENSION ##### -->
52 <para>
53 Expands to "__extension__" when GNU C is used as the compiler.
54 This simply tells GNU C not to warn about the following non-standard code
55 when compiling with the -pedantic option.
56 </para>
57
58
59
60 <!-- ##### MACRO G_GNUC_CONST ##### -->
61 <para>
62 Expands to the GNU C const function attribute if the compiler is GNU C.
63 This enables optimization of the function.
64 See the GNU C documentation for details. 
65 </para>
66
67
68
69 <!-- ##### MACRO G_GNUC_NORETURN ##### -->
70 <para>
71 Expands to the GNU C noreturn function attribute if the compiler is GNU C.
72 It is used for declaring functions which never return.
73 It enables optimization of the function, and avoids possible compiler
74 warnings. See the GNU C documentation for details. 
75 </para>
76
77
78
79 <!-- ##### MACRO G_GNUC_UNUSED ##### -->
80 <para>
81 Expands to the GNU C unused function attribute if the compiler is GNU C.
82 It is used for declaring functions which may never be used.
83 It avoids possible compiler warnings. See the GNU C documentation for details. 
84 </para>
85
86
87
88 <!-- ##### MACRO G_GNUC_PRINTF ##### -->
89 <para>
90 Expands to the GNU C format function attribute if the compiler is GNU C.
91 This is used for declaring functions which take a variable number of
92 arguments, with the same syntax as <function>printf()</function>.
93 It allows the compiler to type-check the arguments passed to the function.
94 See the GNU C documentation for details. 
95 </para>
96
97 @format_idx: the index of the argument corresponding to the format string.
98 (The arguments are numbered from 1).
99 @arg_idx: the index of the first of the format arguments.
100
101
102 <!-- ##### MACRO G_GNUC_SCANF ##### -->
103 <para>
104 Expands to the GNU C format function attribute if the compiler is GNU C.
105 This is used for declaring functions which take a variable number of
106 arguments, with the same syntax as <function>scanf()</function>.
107 It allows the compiler to type-check the arguments passed to the function.
108 See the GNU C documentation for details. 
109 </para>
110
111 @format_idx: the index of the argument corresponding to the format string.
112 (The arguments are numbered from 1).
113 @arg_idx: the index of the first of the format arguments.
114
115
116 <!-- ##### MACRO G_GNUC_FORMAT ##### -->
117 <para>
118 Expands to the GNU C format_arg function attribute if the compiler is GNU C.
119 This is used for declaring functions which take a variable number of
120 parameters, like <function>printf()</function> and
121 <function>scanf()</function>. See the GNU C documentation for details. 
122
123 FIXME: I can't find this in my GNU C documentation. Take out?
124 </para>
125
126 @arg_idx: the index of the argument.
127
128
129 <!-- ##### MACRO G_GNUC_FUNCTION ##### -->
130 <para>
131 Expands to the GNU C __FUNCTION__ variable if the compiler is GNU C,
132 or "" if it isn't.
133 The GNU C __FUNCTION__ variable contains the name of the current function.
134 See the GNU C documentation for details. 
135 </para>
136
137
138
139 <!-- ##### MACRO G_GNUC_PRETTY_FUNCTION ##### -->
140 <para>
141 Expands to the GNU C __PRETTY_FUNCTION__ variable if the compiler is GNU C,
142 or "" if it isn't.
143 The GNU C __PRETTY_FUNCTION__ variable contains the name of the current
144 function. For a C program this is the same as the __FUNCTION__ variable
145 but for C++ it also includes extra information such as the class
146 and function prototype. See the GNU C documentation for details. 
147 </para>
148
149
150
151 <!-- ##### MACRO g_string ##### -->
152 <para>
153 Turns the argument into a string literal by using the '#' stringizing operator.
154 </para>
155
156 @x: text to convert to a literal string.
157
158