destruction cleanup. there's one ->finalize_hook member in the hooklist
[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_BEGIN_DECLS ##### -->
43 <para>
44
45 </para>
46
47
48
49 <!-- ##### MACRO G_END_DECLS ##### -->
50 <para>
51
52 </para>
53
54
55
56 <!-- ##### MACRO G_N_ELEMENTS ##### -->
57 <para>
58
59 </para>
60
61 @arr: 
62
63
64 <!-- ##### MACRO G_VA_COPY ##### -->
65 <para>
66 Portable way to copy <type>va_list</type> variables.
67 </para>
68
69 <!-- # Unused Parameters # -->
70 @ap1: the <type>va_list</type> variable to place a copy of @ap2 in.
71 @ap2: a <type>va_list</type>.
72
73
74 <!-- ##### MACRO G_STRINGIFY ##### -->
75 <para>
76
77 </para>
78
79 @macro_or_string: 
80
81
82 <!-- ##### MACRO G_GNUC_EXTENSION ##### -->
83 <para>
84 Expands to "__extension__" when GNU C is used as the compiler.
85 This simply tells GNU C not to warn about the following non-standard code
86 when compiling with the -pedantic option.
87 </para>
88
89
90
91 <!-- ##### MACRO G_GNUC_CONST ##### -->
92 <para>
93 Expands to the GNU C const function attribute if the compiler is GNU C.
94 This enables optimization of the function.
95 See the GNU C documentation for details. 
96 </para>
97
98
99
100 <!-- ##### MACRO G_GNUC_NORETURN ##### -->
101 <para>
102 Expands to the GNU C noreturn function attribute if the compiler is GNU C.
103 It is used for declaring functions which never return.
104 It enables optimization of the function, and avoids possible compiler
105 warnings. See the GNU C documentation for details. 
106 </para>
107
108
109
110 <!-- ##### MACRO G_GNUC_UNUSED ##### -->
111 <para>
112 Expands to the GNU C unused function attribute if the compiler is GNU C.
113 It is used for declaring functions which may never be used.
114 It avoids possible compiler warnings. See the GNU C documentation for details. 
115 </para>
116
117
118
119 <!-- ##### MACRO G_GNUC_PURE ##### -->
120 <para>
121
122 </para>
123
124
125
126 <!-- ##### MACRO G_GNUC_PRINTF ##### -->
127 <para>
128 Expands to the GNU C format function attribute if the compiler is GNU C.
129 This is used for declaring functions which take a variable number of
130 arguments, with the same syntax as <function>printf()</function>.
131 It allows the compiler to type-check the arguments passed to the function.
132 See the GNU C documentation for details. 
133 </para>
134
135 @format_idx: the index of the argument corresponding to the format string.
136 (The arguments are numbered from 1).
137 @arg_idx: the index of the first of the format arguments.
138
139
140 <!-- ##### MACRO G_GNUC_SCANF ##### -->
141 <para>
142 Expands to the GNU C format function attribute if the compiler is GNU C.
143 This is used for declaring functions which take a variable number of
144 arguments, with the same syntax as <function>scanf()</function>.
145 It allows the compiler to type-check the arguments passed to the function.
146 See the GNU C documentation for details. 
147 </para>
148
149 @format_idx: the index of the argument corresponding to the format string.
150 (The arguments are numbered from 1).
151 @arg_idx: the index of the first of the format arguments.
152
153
154 <!-- ##### MACRO G_GNUC_FORMAT ##### -->
155 <para>
156 Expands to the GNU C format_arg function attribute if the compiler is GNU C.
157 This is used for declaring functions which take a variable number of
158 parameters, like <function>printf()</function> and
159 <function>scanf()</function>. See the GNU C documentation for details. 
160
161 FIXME: I can't find this in my GNU C documentation. Take out?
162 </para>
163
164 @arg_idx: the index of the argument.
165
166
167 <!-- ##### MACRO G_GNUC_FUNCTION ##### -->
168 <para>
169 Expands to the GNU C __FUNCTION__ variable if the compiler is GNU C,
170 or "" if it isn't.
171 The GNU C __FUNCTION__ variable contains the name of the current function.
172 See the GNU C documentation for details. 
173 </para>
174
175
176
177 <!-- ##### MACRO G_GNUC_PRETTY_FUNCTION ##### -->
178 <para>
179 Expands to the GNU C __PRETTY_FUNCTION__ variable if the compiler is GNU C,
180 or "" if it isn't.
181 The GNU C __PRETTY_FUNCTION__ variable contains the name of the current
182 function. For a C program this is the same as the __FUNCTION__ variable
183 but for C++ it also includes extra information such as the class
184 and function prototype. See the GNU C documentation for details. 
185 </para>
186
187
188
189 <!-- ##### MACRO G_STRLOC ##### -->
190 <para>
191
192 </para>
193
194
195
196 <!-- ##### MACRO G_GINT16_FORMAT ##### -->
197 <para>
198 This is the platform dependent conversion specifier for scanning and
199 printing values of type #gint16. It is a string literal, but doesn't
200 include the percent-sign, such that you can add precision and length
201 modifiers between percent-sign and conversion specifier.
202 </para>
203
204 <para>
205 <informalexample>
206 <programlisting>
207 gint16 in;
208 gint32 out;
209 sscanf ("42", "%" G_GINT16_FORMAT, &amp;in)
210 out = in * 1000;
211 g_print ("%" G_GINT32_FORMAT, out);
212 </programlisting>
213 </informalexample>
214 </para>
215
216
217
218 <!-- ##### MACRO G_GUINT16_FORMAT ##### -->
219 <para>
220 This is the platform dependent conversion specifier for scanning and
221 printing values of type #guint16. See also #G_GINT16_FORMAT.
222 </para>
223
224
225
226 <!-- ##### MACRO G_GINT32_FORMAT ##### -->
227 <para>
228 This is the platform dependent conversion specifier for scanning and
229 printing values of type #gint32. See also #G_GINT16_FORMAT.
230 </para>
231
232
233
234 <!-- ##### MACRO G_GUINT32_FORMAT ##### -->
235 <para>
236 This is the platform dependent conversion specifier for scanning and
237 printing values of type #guint32. See also #G_GINT16_FORMAT.
238 </para>
239
240
241
242 <!-- ##### MACRO G_GINT64_FORMAT ##### -->
243 <para>
244 This is the platform dependent conversion specifier for scanning and
245 printing values of type #gint64. See also #G_GINT16_FORMAT.
246 </para>
247
248 <note>
249 <para>
250 Some platforms do not support scanning and printing 64 bit integers,
251 even though the types are supported. On such platforms G_GINT64_FORMAT
252 is not defined.
253 </para>
254 </note>
255
256
257
258 <!-- ##### MACRO G_GUINT64_FORMAT ##### -->
259 <para>
260 This is the platform dependent conversion specifier for scanning and
261 printing values of type #guint64. See also #G_GINT16_FORMAT.
262 </para>
263
264 <note>
265 <para>
266 Some platforms do not support scanning and printing 64 bit integers,
267 even though the types are supported. On such platforms G_GUINT64_FORMAT
268 is not defined.
269 </para>
270 </note>
271
272
273