1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 specialized macros which are not used often.
7 <!-- ##### SECTION Long_Description ##### -->
9 These macros provide more specialized features which are not needed so often
10 by application programmers.
13 <!-- ##### SECTION See_Also ##### -->
18 <!-- ##### MACRO G_INLINE_FUNC ##### -->
20 Used to declare inline functions. If inline functions are not supported on
21 the particular platform, the macro evaluates to the empty string.
26 <!-- ##### MACRO G_STMT_START ##### -->
28 Used within multi-statement macros so that they can be used in places where
29 only one statement is expected by the compiler.
34 <!-- ##### MACRO G_STMT_END ##### -->
36 Used within multi-statement macros so that they can be used in places where
37 only one statement is expected by the compiler.
42 <!-- ##### MACRO G_BEGIN_DECLS ##### -->
44 Used (along with #G_END_DECLS) to bracket header files. If the
45 compiler in use is a C++ compiler, adds 'extern "C"' around the header.
50 <!-- ##### MACRO G_END_DECLS ##### -->
52 Used (along with #G_BEGIN_DECLS) to bracket header files. If the
53 compiler in use is a C++ compiler, adds <literal>extern "C"</literal>
59 <!-- ##### MACRO G_N_ELEMENTS ##### -->
61 Determines the number of elements in an array. The array must be
62 declared so the compiler knows its size at compile-time; this
63 macro will not work on an array allocated on the heap, only static
64 arrays or arrays on the stack.
70 <!-- ##### MACRO G_VA_COPY ##### -->
72 Portable way to copy <type>va_list</type> variables.
75 In order to use this function, you must include <filename>string.h</filename>
76 yourself, because this macro may use <function>memmove()</function> and GLib
77 does not include <function>string.h</function> for you.
80 @ap1: the <type>va_list</type> variable to place a copy of @ap2 in.
81 @ap2: a <type>va_list</type>.
84 <!-- ##### MACRO G_STRINGIFY ##### -->
86 Accepts a macro or a string and converts it into a string.
89 @macro_or_string: a macro or a string.
92 <!-- ##### MACRO G_GNUC_EXTENSION ##### -->
94 Expands to <literal>__extension__</literal> when GNU C is used as the compiler.
95 This simply tells GNU C not to warn about the following non-standard code
96 when compiling with the <literal>-pedantic</literal> option.
101 <!-- ##### MACRO G_GNUC_CONST ##### -->
103 Expands to the GNU C const function attribute if the compiler is GNU C.
104 This enables optimization of the function.
105 See the GNU C documentation for details.
110 <!-- ##### MACRO G_GNUC_NORETURN ##### -->
112 Expands to the GNU C noreturn function attribute if the compiler is GNU C.
113 It is used for declaring functions which never return.
114 It enables optimization of the function, and avoids possible compiler
115 warnings. See the GNU C documentation for details.
120 <!-- ##### MACRO G_GNUC_UNUSED ##### -->
122 Expands to the GNU C unused function attribute if the compiler is GNU C.
123 It is used for declaring functions which may never be used.
124 It avoids possible compiler warnings. See the GNU C documentation for details.
129 <!-- ##### MACRO G_GNUC_PURE ##### -->
131 Expands to the GNU C pure function attribute if the compiler is GNU C.
132 See the GNU C documentation for details.
134 FIXME: Explain what pure functions are.
139 <!-- ##### MACRO G_GNUC_PRINTF ##### -->
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>printf()</function>.
144 It allows the compiler to type-check the arguments passed to the function.
145 See the GNU C documentation for details.
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.
153 <!-- ##### MACRO G_GNUC_SCANF ##### -->
155 Expands to the GNU C format function attribute if the compiler is GNU C.
156 This is used for declaring functions which take a variable number of
157 arguments, with the same syntax as <function>scanf()</function>.
158 It allows the compiler to type-check the arguments passed to the function.
159 See the GNU C documentation for details.
162 @format_idx: the index of the argument corresponding to the format string.
163 (The arguments are numbered from 1).
164 @arg_idx: the index of the first of the format arguments.
167 <!-- ##### MACRO G_GNUC_FORMAT ##### -->
169 Expands to the GNU C format_arg function attribute if the compiler is GNU C.
170 This is used for declaring functions which take a variable number of
171 parameters, like <function>printf()</function> and
172 <function>scanf()</function>. See the GNU C documentation for details.
174 FIXME: I can't find this in my GNU C documentation. Take out?
177 @arg_idx: the index of the argument.
180 <!-- ##### MACRO G_GNUC_FUNCTION ##### -->
182 Expands to the GNU C <literal>__FUNCTION__</literal> variable if the
183 compiler is GNU C, or "" if it isn't. The GNU C
184 <literal>__FUNCTION__</literal> variable contains the name of the
185 current function. See the GNU C documentation for details.
190 <!-- ##### MACRO G_GNUC_PRETTY_FUNCTION ##### -->
192 Expands to the GNU C <literal>__PRETTY_FUNCTION__</literal> variable
193 if the compiler is GNU C, or "" if it isn't.
194 The GNU C <literal>__PRETTY_FUNCTION__</literal> variable contains the
195 name of the current function. For a C program this is the same as the
196 <literal>__FUNCTION__</literal> variable but for C++ it also includes
197 extra information such as the class and function prototype. See the
198 GNU C documentation for details.
203 <!-- ##### MACRO G_GNUC_NO_INSTRUMENT ##### -->
205 Expands to the GNU C no_instrument_function function attribute if
206 the compiler is GNU C.
207 See the GNU C documentation for details.
209 FIXME: Explain no_instrument_function.
214 <!-- ##### MACRO G_STRLOC ##### -->
216 Expands to a string identifying the current code position.
221 <!-- ##### MACRO G_GINT16_FORMAT ##### -->
223 This is the platform dependent conversion specifier for scanning and
224 printing values of type #gint16. It is a string literal, but doesn't
225 include the percent-sign, such that you can add precision and length
226 modifiers between percent-sign and conversion specifier.
234 sscanf ("42", "%" G_GINT16_FORMAT, &in)
236 g_print ("%" G_GINT32_FORMAT, out);
243 <!-- ##### MACRO G_GUINT16_FORMAT ##### -->
245 This is the platform dependent conversion specifier for scanning and
246 printing values of type #guint16. See also #G_GINT16_FORMAT.
251 <!-- ##### MACRO G_GINT32_FORMAT ##### -->
253 This is the platform dependent conversion specifier for scanning and
254 printing values of type #gint32. See also #G_GINT16_FORMAT.
259 <!-- ##### MACRO G_GUINT32_FORMAT ##### -->
261 This is the platform dependent conversion specifier for scanning and
262 printing values of type #guint32. See also #G_GINT16_FORMAT.
267 <!-- ##### MACRO G_GINT64_FORMAT ##### -->
269 This is the platform dependent conversion specifier for scanning and
270 printing values of type #gint64. See also #G_GINT16_FORMAT.
275 Some platforms do not support scanning and printing 64 bit integers,
276 even though the types are supported. On such platforms #G_GINT64_FORMAT
283 <!-- ##### MACRO G_GUINT64_FORMAT ##### -->
285 This is the platform dependent conversion specifier for scanning and
286 printing values of type #guint64. See also #G_GINT16_FORMAT.
291 Some platforms do not support scanning and printing 64 bit integers,
292 even though the types are supported. On such platforms #G_GUINT64_FORMAT