|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/22697/root/usr/share/gtk-doc/html/glib/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Miscellaneous Macros</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="prev" href="glib-Numerical-Definitions.html" title="Numerical Definitions">
<link rel="next" href="glib-Atomic-Operations.html" title="Atomic Operations">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Numerical-Definitions.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-fundamentals.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-Atomic-Operations.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2868124" class="shortcut">Top</a>
 | 
<a href="#id2868495" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-Miscellaneous-Macros"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2868124"></a><span class="refentrytitle">Miscellaneous Macros</span>
</h2>
<p>Miscellaneous Macros — specialized macros which are not used often.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <glib.h>
#define <a href="glib-Miscellaneous-Macros.html#G-INLINE-FUNC:CAPS">G_INLINE_FUNC</a>
#define <a href="glib-Miscellaneous-Macros.html#G-STMT-START:CAPS">G_STMT_START</a>
#define <a href="glib-Miscellaneous-Macros.html#G-STMT-END:CAPS">G_STMT_END</a>
#define <a href="glib-Miscellaneous-Macros.html#G-BEGIN-DECLS:CAPS">G_BEGIN_DECLS</a>
#define <a href="glib-Miscellaneous-Macros.html#G-END-DECLS:CAPS">G_END_DECLS</a>
#define <a href="glib-Miscellaneous-Macros.html#G-N-ELEMENTS:CAPS">G_N_ELEMENTS</a> (arr)
#define <a href="glib-Miscellaneous-Macros.html#G-VA-COPY:CAPS">G_VA_COPY</a> (ap1,ap2)
#define <a href="glib-Miscellaneous-Macros.html#G-STRINGIFY:CAPS">G_STRINGIFY</a> (macro_or_string)
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-EXTENSION:CAPS">G_GNUC_EXTENSION</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-CONST:CAPS">G_GNUC_CONST</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-PURE:CAPS">G_GNUC_PURE</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-MALLOC:CAPS">G_GNUC_MALLOC</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED:CAPS">G_GNUC_DEPRECATED</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-NORETURN:CAPS">G_GNUC_NORETURN</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-UNUSED:CAPS">G_GNUC_UNUSED</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-PRINTF:CAPS">G_GNUC_PRINTF</a> ( format_idx, arg_idx )
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-SCANF:CAPS">G_GNUC_SCANF</a> ( format_idx, arg_idx )
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-FORMAT:CAPS">G_GNUC_FORMAT</a> ( arg_idx )
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-NULL-TERMINATED:CAPS">G_GNUC_NULL_TERMINATED</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-WARN-UNUSED-RESULT:CAPS">G_GNUC_WARN_UNUSED_RESULT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-FUNCTION:CAPS">G_GNUC_FUNCTION</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-PRETTY-FUNCTION:CAPS">G_GNUC_PRETTY_FUNCTION</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-NO-INSTRUMENT:CAPS">G_GNUC_NO_INSTRUMENT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-HAVE-GNUC-VISIBILITY:CAPS">G_HAVE_GNUC_VISIBILITY</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GNUC-INTERNAL:CAPS">G_GNUC_INTERNAL</a>
#define <a href="glib-Miscellaneous-Macros.html#G-LIKELY:CAPS">G_LIKELY</a> (expr)
#define <a href="glib-Miscellaneous-Macros.html#G-UNLIKELY:CAPS">G_UNLIKELY</a> (expr)
#define <a href="glib-Miscellaneous-Macros.html#G-STRLOC:CAPS">G_STRLOC</a>
#define <a href="glib-Miscellaneous-Macros.html#G-STRFUNC:CAPS">G_STRFUNC</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GINT16-MODIFIER:CAPS">G_GINT16_MODIFIER</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS">G_GINT16_FORMAT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GUINT16-FORMAT:CAPS">G_GUINT16_FORMAT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GINT32-MODIFIER:CAPS">G_GINT32_MODIFIER</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GINT32-FORMAT:CAPS">G_GINT32_FORMAT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GUINT32-FORMAT:CAPS">G_GUINT32_FORMAT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GINT64-MODIFIER:CAPS">G_GINT64_MODIFIER</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GINT64-FORMAT:CAPS">G_GINT64_FORMAT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GUINT64-FORMAT:CAPS">G_GUINT64_FORMAT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GSIZE-MODIFIER:CAPS">G_GSIZE_MODIFIER</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GSIZE-FORMAT:CAPS">G_GSIZE_FORMAT</a>
#define <a href="glib-Miscellaneous-Macros.html#G-GSSIZE-FORMAT:CAPS">G_GSSIZE_FORMAT</a>
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2868495"></a><h2>Description</h2>
<p>
These macros provide more specialized features which are not needed so often
by application programmers.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2868512"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2868522"></a><h3>
<a name="G-INLINE-FUNC:CAPS"></a>G_INLINE_FUNC</h3>
<a class="indexterm" name="id2868534"></a><pre class="programlisting">#define G_INLINE_FUNC</pre>
<p>
This macro is used to export function prototypes so they can be linked
with an external version when no inlining is performed. The file which
implements the functions should define <code class="literal">G_IMPLEMENTS_INLINES</code>
before including the headers which contain <a href="glib-Miscellaneous-Macros.html#G-INLINE-FUNC:CAPS"><code class="literal">G_INLINE_FUNC</code></a> declarations.
Since inlining is very compiler-dependent using these macros correctly
is very difficult. Their use is strongly discouraged.
</p>
<p>
This macro is often mistaken for a replacement for the inline keyword;
inline is already declared in a portable manner in the glib headers
and can be used normally.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868584"></a><h3>
<a name="G-STMT-START:CAPS"></a>G_STMT_START</h3>
<a class="indexterm" name="id2868597"></a><pre class="programlisting">#define G_STMT_START</pre>
<p>
Used within multi-statement macros so that they can be used in places where
only one statement is expected by the compiler.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868614"></a><h3>
<a name="G-STMT-END:CAPS"></a>G_STMT_END</h3>
<a class="indexterm" name="id2868627"></a><pre class="programlisting">#define G_STMT_END</pre>
<p>
Used within multi-statement macros so that they can be used in places where
only one statement is expected by the compiler.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868644"></a><h3>
<a name="G-BEGIN-DECLS:CAPS"></a>G_BEGIN_DECLS</h3>
<a class="indexterm" name="id2868657"></a><pre class="programlisting">#define G_BEGIN_DECLS</pre>
<p>
Used (along with <a href="glib-Miscellaneous-Macros.html#G-END-DECLS:CAPS"><span class="type">G_END_DECLS</span></a>) to bracket header files. If the
compiler in use is a C++ compiler, adds <code class="literal">extern "C"</code>
around the header.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868688"></a><h3>
<a name="G-END-DECLS:CAPS"></a>G_END_DECLS</h3>
<a class="indexterm" name="id2868701"></a><pre class="programlisting">#define G_END_DECLS</pre>
<p>
Used (along with <a href="glib-Miscellaneous-Macros.html#G-BEGIN-DECLS:CAPS"><span class="type">G_BEGIN_DECLS</span></a>) to bracket header files. If the
compiler in use is a C++ compiler, adds <code class="literal">extern "C"</code>
around the header.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868731"></a><h3>
<a name="G-N-ELEMENTS:CAPS"></a>G_N_ELEMENTS()</h3>
<a class="indexterm" name="id2868744"></a><pre class="programlisting">#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
</pre>
<p>
Determines the number of elements in an array. The array must be
declared so the compiler knows its size at compile-time; this
macro will not work on an array allocated on the heap, only static
arrays or arrays on the stack.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>arr</code></em> :</span></td>
<td>the array
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868782"></a><h3>
<a name="G-VA-COPY:CAPS"></a>G_VA_COPY()</h3>
<a class="indexterm" name="id2868795"></a><pre class="programlisting">#define G_VA_COPY(ap1,ap2)</pre>
<p>
Portable way to copy <span class="type">va_list</span> variables.
</p>
<p>
In order to use this function, you must include <code class="filename">string.h</code>
yourself, because this macro may use <code class="function"><code class="function">memmove()</code></code> and GLib
does not include <code class="function">string.h</code> for you.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ap1</code></em> :</span></td>
<td>the <span class="type">va_list</span> variable to place a copy of <em class="parameter"><code>ap2</code></em> in.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>ap2</code></em> :</span></td>
<td>a <span class="type">va_list</span>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868890"></a><h3>
<a name="G-STRINGIFY:CAPS"></a>G_STRINGIFY()</h3>
<a class="indexterm" name="id2868902"></a><pre class="programlisting">#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string)
</pre>
<p>
Accepts a macro or a string and converts it into a string.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>macro_or_string</code></em> :</span></td>
<td>a macro or a string.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868938"></a><h3>
<a name="G-GNUC-EXTENSION:CAPS"></a>G_GNUC_EXTENSION</h3>
<a class="indexterm" name="id2868952"></a><pre class="programlisting">#define G_GNUC_EXTENSION</pre>
<p>
Expands to <code class="literal">__extension__</code> when <span><strong class="command">gcc</strong></span> is
used as the compiler.
This simply tells <span><strong class="command">gcc</strong></span> not to warn about the following non-standard code
when compiling with the <code class="option">-pedantic</code> option.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2868990"></a><h3>
<a name="G-GNUC-CONST:CAPS"></a>G_GNUC_CONST</h3>
<a class="indexterm" name="id2869002"></a><pre class="programlisting">#define G_GNUC_CONST</pre>
<p>
Expands to the GNU C <code class="literal">const</code> function attribute if the compiler is
<span><strong class="command">gcc</strong></span>. Declaring a function as const enables better optimization of calls
to the function. A const function doesn't examine any values except its parameters, and has no
effects except its return value. See the GNU C documentation for details.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
A function that has pointer arguments and examines the data pointed to
must <span class="emphasis"><em>not</em></span> be declared const. Likewise, a function that
calls a non-const function usually must not be const. It doesn't make sense
for a const function to return void.
</p>
</div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869046"></a><h3>
<a name="G-GNUC-PURE:CAPS"></a>G_GNUC_PURE</h3>
<a class="indexterm" name="id2869059"></a><pre class="programlisting">#define G_GNUC_PURE</pre>
<p>
Expands to the GNU C <code class="literal">pure</code> function attribute if the compiler is
<span><strong class="command">gcc</strong></span>. Declaring a function as pure enables better optimization of
calls to the function. A pure function has no effects except its return value and the
return value depends only on the parameters and/or global variables.
See the GNU C documentation for details.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869090"></a><h3>
<a name="G-GNUC-MALLOC:CAPS"></a>G_GNUC_MALLOC</h3>
<a class="indexterm" name="id2869106"></a><pre class="programlisting">#define G_GNUC_MALLOC</pre>
<p>
Expands to the GNU C <code class="literal">malloc</code> function attribute if the compiler is
<span><strong class="command">gcc</strong></span>. Declaring a function as malloc enables better optimization of the
function. A function can have the malloc attribute if it returns a pointer which is guaranteed
to not alias with any other pointer when the function returns (in practice, this means newly
allocated memory).
See the GNU C documentation for details.
</p>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869143"></a><h3>
<a name="G-GNUC-DEPRECATED:CAPS"></a>G_GNUC_DEPRECATED</h3>
<a class="indexterm" name="id2869159"></a><pre class="programlisting">#define G_GNUC_DEPRECATED</pre>
<p>
Expands to the GNU C <code class="literal">deprecated</code> attribute if the compiler
is <span><strong class="command">gcc</strong></span>.
It can be used to mark typedefs, variables and functions as deprecated.
When called with the <code class="option">-Wdeprecated</code> option, the compiler will
generate warnings when deprecated interfaces are used.
See the GNU C documentation for details.
</p>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869199"></a><h3>
<a name="G-GNUC-NORETURN:CAPS"></a>G_GNUC_NORETURN</h3>
<a class="indexterm" name="id2869212"></a><pre class="programlisting">#define G_GNUC_NORETURN</pre>
<p>
Expands to the GNU C <code class="literal">noreturn</code> function attribute if the
compiler is <span><strong class="command">gcc</strong></span>. It is used for declaring functions which never return.
It enables optimization of the function, and avoids possible compiler
warnings. See the GNU C documentation for details.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869243"></a><h3>
<a name="G-GNUC-UNUSED:CAPS"></a>G_GNUC_UNUSED</h3>
<a class="indexterm" name="id2869255"></a><pre class="programlisting">#define G_GNUC_UNUSED</pre>
<p>
Expands to the GNU C <code class="literal">unused</code> function attribute if the compiler is
<span><strong class="command">gcc</strong></span>. It is used for declaring functions which may never be used.
It avoids possible compiler warnings. See the GNU C documentation for details.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869285"></a><h3>
<a name="G-GNUC-PRINTF:CAPS"></a>G_GNUC_PRINTF()</h3>
<a class="indexterm" name="id2869298"></a><pre class="programlisting">#define G_GNUC_PRINTF( format_idx, arg_idx )</pre>
<p>
Expands to the GNU C <code class="literal">format</code> function attribute if the compiler is
<span><strong class="command">gcc</strong></span>. This is used for declaring functions which take a variable number of
arguments, with the same syntax as <code class="function"><code class="function">printf()</code></code>.
It allows the compiler to type-check the arguments passed to the function.
See the GNU C documentation for details.
</p>
<div class="informalexample"><pre class="programlisting">
gint g_snprintf (gchar *string,
gulong n,
gchar const *format,
...) G_GNUC_PRINTF (3, 4);
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>format_idx</code></em> :</span></td>
<td>the index of the argument corresponding to the format string.
(The arguments are numbered from 1).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>arg_idx</code></em> :</span></td>
<td>the index of the first of the format arguments.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869388"></a><h3>
<a name="G-GNUC-SCANF:CAPS"></a>G_GNUC_SCANF()</h3>
<a class="indexterm" name="id2869401"></a><pre class="programlisting">#define G_GNUC_SCANF( format_idx, arg_idx )</pre>
<p>
Expands to the GNU C <code class="literal">format</code> function attribute if the compiler is <span><strong class="command">gcc</strong></span>.
This is used for declaring functions which take a variable number of
arguments, with the same syntax as <code class="function"><code class="function">scanf()</code></code>.
It allows the compiler to type-check the arguments passed to the function.
See the GNU C documentation for details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>format_idx</code></em> :</span></td>
<td>the index of the argument corresponding to the format string.
(The arguments are numbered from 1).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>arg_idx</code></em> :</span></td>
<td>the index of the first of the format arguments.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869481"></a><h3>
<a name="G-GNUC-FORMAT:CAPS"></a>G_GNUC_FORMAT()</h3>
<a class="indexterm" name="id2869494"></a><pre class="programlisting">#define G_GNUC_FORMAT( arg_idx )</pre>
<p>
Expands to the GNU C <code class="literal">format_arg</code> function attribute if the compiler is <span><strong class="command">gcc</strong></span>.
This function attribute specifies that a function takes a format
string for a <code class="function"><code class="function">printf()</code></code>, <code class="function"><code class="function">scanf()</code></code>,
<code class="function"><code class="function">strftime()</code></code> or <code class="function"><code class="function">strfmon()</code></code> style
function and modifies it, so that the result can be passed to a
<code class="function"><code class="function">printf()</code></code>, <code class="function"><code class="function">scanf()</code></code>,
<code class="function"><code class="function">strftime()</code></code> or <code class="function"><code class="function">strfmon()</code></code> style
function (with the remaining arguments to the format function the same as
they would have been for the unmodified string).
See the GNU C documentation for details.
</p>
<div class="informalexample"><pre class="programlisting">
gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2);
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>arg_idx</code></em> :</span></td>
<td>the index of the argument.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869664"></a><h3>
<a name="G-GNUC-NULL-TERMINATED:CAPS"></a>G_GNUC_NULL_TERMINATED</h3>
<a class="indexterm" name="id2869677"></a><pre class="programlisting">#define G_GNUC_NULL_TERMINATED</pre>
<p>
Expands to the GNU C <code class="literal">sentinel</code> function attribute if the
compiler is <span><strong class="command">gcc</strong></span>, or "" if it isn't. This function attribute
only applies to variadic functions and instructs the compiler to check that
the argument list is terminated with an explicit <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
See the GNU C documentation for details.
</p>
Since: 2.8</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869720"></a><h3>
<a name="G-GNUC-WARN-UNUSED-RESULT:CAPS"></a>G_GNUC_WARN_UNUSED_RESULT</h3>
<a class="indexterm" name="id2869737"></a><pre class="programlisting">#define G_GNUC_WARN_UNUSED_RESULT</pre>
<p>
Expands to the GNU C <code class="literal">warn_unused_ersult</code> function attribute
if the compiler is <span><strong class="command">gcc</strong></span>, or "" if it isn't. This function
attribute makes the compiler emit a warning if the result of a function call
is ignored. See the GNU C documentation for details.
</p>
<p>Since 2.10
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869773"></a><h3>
<a name="G-GNUC-FUNCTION:CAPS"></a>G_GNUC_FUNCTION</h3>
<a class="indexterm" name="id2869787"></a><pre class="programlisting">#define G_GNUC_FUNCTION</pre>
<p>
Expands to the GNU C <code class="literal">__FUNCTION__</code> variable if the
compiler is <span><strong class="command">gcc</strong></span>, or "" if it isn't. The GNU C
<code class="literal">__FUNCTION__</code> variable contains the name of the
current function. See the GNU C documentation for details.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869821"></a><h3>
<a name="G-GNUC-PRETTY-FUNCTION:CAPS"></a>G_GNUC_PRETTY_FUNCTION</h3>
<a class="indexterm" name="id2869834"></a><pre class="programlisting">#define G_GNUC_PRETTY_FUNCTION</pre>
<p>
Expands to the GNU C <code class="literal">__PRETTY_FUNCTION__</code> variable
if the compiler is <span><strong class="command">gcc</strong></span>, or "" if it isn't.
The GNU C <code class="literal">__PRETTY_FUNCTION__</code> variable contains the
name of the current function. For a C program this is the same as the
<code class="literal">__FUNCTION__</code> variable but for C++ it also includes
extra information such as the class and function prototype. See the
GNU C documentation for details.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869879"></a><h3>
<a name="G-GNUC-NO-INSTRUMENT:CAPS"></a>G_GNUC_NO_INSTRUMENT</h3>
<a class="indexterm" name="id2869892"></a><pre class="programlisting">#define G_GNUC_NO_INSTRUMENT</pre>
<p>
Expands to the GNU C <code class="literal">no_instrument_function</code> function
attribute if the compiler is <span><strong class="command">gcc</strong></span>. Functions with this
attribute will not be
instrumented for profiling, when the compiler is called with the
<code class="option">-finstrument-functions</code> option.
See the GNU C documentation for details.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869927"></a><h3>
<a name="G-HAVE-GNUC-VISIBILITY:CAPS"></a>G_HAVE_GNUC_VISIBILITY</h3>
<a class="indexterm" name="id2869939"></a><pre class="programlisting">#define G_HAVE_GNUC_VISIBILITY 1
</pre>
<p>
This macro is defined as 1 if the the compiler supports ELF visibility
attributes (currently only <span><strong class="command">gcc</strong></span>).
</p>
Since: 2.6</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2869964"></a><h3>
<a name="G-GNUC-INTERNAL:CAPS"></a>G_GNUC_INTERNAL</h3>
<a class="indexterm" name="id2869977"></a><pre class="programlisting">#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
</pre>
<p>
Expands to the GNU C <code class="literal">visibility(hidden)</code> attribute if the
compiler supports it (currently only <span><strong class="command">gcc</strong></span>). This attribute
can be used for marking library functions as being used internally to the lib
only, to not create inefficient PLT entries. Note that static functions do not
need to be marked as internal in this way. See the GNU C documentation for details.
</p>
Since: 2.6</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870012"></a><h3>
<a name="G-LIKELY:CAPS"></a>G_LIKELY()</h3>
<a class="indexterm" name="id2870027"></a><pre class="programlisting">#define G_LIKELY(expr)</pre>
<p>
Hints the compiler that the expression is likely to evaluate to a true
value. The compiler may use this information for optimizations.
</p>
<div class="informalexample"><pre class="programlisting">
if (G_LIKELY (<code class="function">random()</code> != 1))
g_print ("not one");
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>expr</code></em> :</span></td>
<td>the expression
</td>
</tr></tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870086"></a><h3>
<a name="G-UNLIKELY:CAPS"></a>G_UNLIKELY()</h3>
<a class="indexterm" name="id2870100"></a><pre class="programlisting">#define G_UNLIKELY(expr)</pre>
<p>
Hints the compiler that the expression is unlikely to evaluate to a true
value. The compiler may use this information for optimizations.
</p>
<div class="informalexample"><pre class="programlisting">
if (G_UNLIKELY (<code class="function">random()</code> == 1))
g_print ("a random one");
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>expr</code></em> :</span></td>
<td>the expression
</td>
</tr></tbody>
</table></div>
<p>Since 2.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870159"></a><h3>
<a name="G-STRLOC:CAPS"></a>G_STRLOC</h3>
<a class="indexterm" name="id2870171"></a><pre class="programlisting">#define G_STRLOC</pre>
<p>
Expands to a string identifying the current code position.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870187"></a><h3>
<a name="G-STRFUNC:CAPS"></a>G_STRFUNC</h3>
<a class="indexterm" name="id2870202"></a><pre class="programlisting">#define G_STRFUNC</pre>
<p>
Expands to a string identifying the current function.
</p>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870222"></a><h3>
<a name="G-GINT16-MODIFIER:CAPS"></a>G_GINT16_MODIFIER</h3>
<a class="indexterm" name="id2870238"></a><pre class="programlisting">#define G_GINT16_MODIFIER "h"
</pre>
<p>
The platform dependent length modifier for constructing <code class="function">printf()</code> conversion
specifiers for values of type <a href="glib-Basic-Types.html#gint16"><span class="type">gint16</span></a> or <a href="glib-Basic-Types.html#guint16"><span class="type">guint16</span></a>. It is a string literal,
but doesn't include the percent-sign, such that you can add precision and
length modifiers between percent-sign and conversion specifier and append a
conversion specifier.
</p>
<p>
The following example prints "0x7b";
</p>
<div class="informalexample"><pre class="programlisting">
gint16 value = 123;
g_print ("%#" G_GINT16_MODIFIER "x", value);
</pre></div>
<p>
</p>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870303"></a><h3>
<a name="G-GINT16-FORMAT:CAPS"></a>G_GINT16_FORMAT</h3>
<a class="indexterm" name="id2870316"></a><pre class="programlisting">#define G_GINT16_FORMAT "hi"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a href="glib-Basic-Types.html#gint16"><span class="type">gint16</span></a>. It is a string literal, but doesn't
include the percent-sign, such that you can add precision and length
modifiers between percent-sign and conversion specifier.
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
gint16 in;
gint32 out;
sscanf ("42", "%" G_GINT16_FORMAT, &in)
out = in * 1000;
g_print ("%" G_GINT32_FORMAT, out);
</pre></div>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870358"></a><h3>
<a name="G-GUINT16-FORMAT:CAPS"></a>G_GUINT16_FORMAT</h3>
<a class="indexterm" name="id2870372"></a><pre class="programlisting">#define G_GUINT16_FORMAT "hu"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a href="glib-Basic-Types.html#guint16"><span class="type">guint16</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870405"></a><h3>
<a name="G-GINT32-MODIFIER:CAPS"></a>G_GINT32_MODIFIER</h3>
<a class="indexterm" name="id2870420"></a><pre class="programlisting">#define G_GINT32_MODIFIER ""
</pre>
<p>
The platform dependent length modifier for constructing <code class="function">printf()</code> conversion
specifiers for values of type <a href="glib-Basic-Types.html#gint32"><span class="type">gint32</span></a> or <a href="glib-Basic-Types.html#guint32"><span class="type">guint32</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-MODIFIER:CAPS"><span class="type">G_GINT16_MODIFIER</span></a>.
</p>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870477"></a><h3>
<a name="G-GINT32-FORMAT:CAPS"></a>G_GINT32_FORMAT</h3>
<a class="indexterm" name="id2870489"></a><pre class="programlisting">#define G_GINT32_FORMAT "i"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a href="glib-Basic-Types.html#gint32"><span class="type">gint32</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870523"></a><h3>
<a name="G-GUINT32-FORMAT:CAPS"></a>G_GUINT32_FORMAT</h3>
<a class="indexterm" name="id2870536"></a><pre class="programlisting">#define G_GUINT32_FORMAT "u"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a href="glib-Basic-Types.html#guint32"><span class="type">guint32</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870569"></a><h3>
<a name="G-GINT64-MODIFIER:CAPS"></a>G_GINT64_MODIFIER</h3>
<a class="indexterm" name="id2870585"></a><pre class="programlisting">#define G_GINT64_MODIFIER "ll"
</pre>
<p>
The platform dependent length modifier for constructing <code class="function">printf()</code> conversion
specifiers for values of type <a href="glib-Basic-Types.html#gint64"><span class="type">gint64</span></a> or <a href="glib-Basic-Types.html#guint64"><span class="type">guint64</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-MODIFIER:CAPS"><span class="type">G_GINT16_MODIFIER</span></a>.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Some platforms do not support printing 64 bit integers,
even though the types are supported. On such platforms <a href="glib-Miscellaneous-Macros.html#G-GINT64-MODIFIER:CAPS"><span class="type">G_GINT64_MODIFIER</span></a>
is not defined.
</p>
</div>
<p>Since 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870658"></a><h3>
<a name="G-GINT64-FORMAT:CAPS"></a>G_GINT64_FORMAT</h3>
<a class="indexterm" name="id2870671"></a><pre class="programlisting">#define G_GINT64_FORMAT "lli"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a href="glib-Basic-Types.html#gint64"><span class="type">gint64</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Some platforms do not support scanning and printing 64 bit integers,
even though the types are supported. On such platforms <a href="glib-Miscellaneous-Macros.html#G-GINT64-FORMAT:CAPS"><span class="type">G_GINT64_FORMAT</span></a>
is not defined. Note that <code class="function">scanf()</code> may not support 64 bit integers, even
if <a href="glib-Miscellaneous-Macros.html#G-GINT64-FORMAT:CAPS"><span class="type">G_GINT64_FORMAT</span></a> is defined. Due to its weak error handling, <code class="function">scanf()</code> is not
recommended for parsing anyway; consider using <code class="function">g_strtoull()</code> instead.
</p>
</div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870765"></a><h3>
<a name="G-GUINT64-FORMAT:CAPS"></a>G_GUINT64_FORMAT</h3>
<a class="indexterm" name="id2870778"></a><pre class="programlisting">#define G_GUINT64_FORMAT "llu"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a href="glib-Basic-Types.html#guint64"><span class="type">guint64</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Some platforms do not support scanning and printing 64 bit integers,
even though the types are supported. On such platforms <a href="glib-Miscellaneous-Macros.html#G-GUINT64-FORMAT:CAPS"><span class="type">G_GUINT64_FORMAT</span></a>
is not defined. Note that <code class="function">scanf()</code> may not support 64 bit integers, even
if <a href="glib-Miscellaneous-Macros.html#G-GINT64-FORMAT:CAPS"><span class="type">G_GINT64_FORMAT</span></a> is defined. Due to its weak error handling, <code class="function">scanf()</code> is not
recommended for parsing anyway; consider using <code class="function">g_strtoull()</code> instead.
</p>
</div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870871"></a><h3>
<a name="G-GSIZE-MODIFIER:CAPS"></a>G_GSIZE_MODIFIER</h3>
<a class="indexterm" name="id2870886"></a><pre class="programlisting">#define G_GSIZE_MODIFIER ""
</pre>
<p>
The platform dependent length modifier for constructing <code class="function">printf()</code> conversion
specifiers for values of type <a href="glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> or <a href="glib-Basic-Types.html#gssize"><span class="type">gssize</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-MODIFIER:CAPS"><span class="type">G_GINT16_MODIFIER</span></a>.
</p>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870942"></a><h3>
<a name="G-GSIZE-FORMAT:CAPS"></a>G_GSIZE_FORMAT</h3>
<a class="indexterm" name="id2870957"></a><pre class="programlisting">#define G_GSIZE_FORMAT "u"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a href="glib-Basic-Types.html#gsize"><span class="type">gsize</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2870995"></a><h3>
<a name="G-GSSIZE-FORMAT:CAPS"></a>G_GSSIZE_FORMAT</h3>
<a class="indexterm" name="id2871011"></a><pre class="programlisting">#define G_GSSIZE_FORMAT "i"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a href="glib-Basic-Types.html#gssize"><span class="type">gssize</span></a>. See also <a href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
<p>Since 2.6
</p>
</div>
</div>
</div>
</body>
</html>