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