<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="glib-Standard-Macros">
<refmeta>
<refentrytitle role="top_of_page" id="glib-Standard-Macros.top_of_page">Standard Macros</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Standard Macros</refname>
<refpurpose>commonly-used macros</refpurpose>
</refnamediv>

<refsect1 id="glib-Standard-Macros.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-IS-DIR-SEPARATOR:CAPS">G_IS_DIR_SEPARATOR</link><phrase role="c_punctuation">()</phrase></entry></row>



<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="MIN:CAPS">MIN</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="MAX:CAPS">MAX</link><phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="ABS:CAPS">ABS</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="CLAMP:CAPS">CLAMP</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-APPROX-VALUE:CAPS">G_APPROX_VALUE</link><phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-SIZEOF-MEMBER:CAPS">G_SIZEOF_MEMBER</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-STRUCT-MEMBER:CAPS">G_STRUCT_MEMBER</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-STRUCT-MEMBER-P:CAPS">G_STRUCT_MEMBER_P</link><phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-STRUCT-OFFSET:CAPS">G_STRUCT_OFFSET</link><phrase role="c_punctuation">()</phrase></entry></row>


<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-ALIGNOF:CAPS">G_ALIGNOF</link><phrase role="c_punctuation">()</phrase></entry></row>


<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-N-ELEMENTS:CAPS">G_N_ELEMENTS</link><phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="glib-Standard-Macros.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OS-WIN32:CAPS">G_OS_WIN32</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-OS-UNIX:CAPS">G_OS_UNIX</link></entry></row>

<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-DIR-SEPARATOR:CAPS">G_DIR_SEPARATOR</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-DIR-SEPARATOR-S:CAPS">G_DIR_SEPARATOR_S</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-SEARCHPATH-SEPARATOR:CAPS">G_SEARCHPATH_SEPARATOR</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-SEARCHPATH-SEPARATOR-S:CAPS">G_SEARCHPATH_SEPARATOR_S</link></entry></row>

<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="TRUE:CAPS">TRUE</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="FALSE:CAPS">FALSE</link></entry></row>

<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="NULL:CAPS">NULL</link></entry></row>




<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-MEM-ALIGN:CAPS">G_MEM_ALIGN</link></entry></row>


<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-CONST-RETURN:CAPS">G_CONST_RETURN</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 id="glib-Standard-Macros.includes"><title>Includes</title><synopsis>#include &lt;glib.h&gt;
</synopsis></refsect1>

<refsect1 id="glib-Standard-Macros.description" role="desc">
<title role="desc.title">Description</title>
<para>These macros provide a few commonly-used features.</para>

</refsect1>
<refsect1 id="glib-Standard-Macros.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="G-IS-DIR-SEPARATOR:CAPS" role="macro" condition="since:2.6">
<title>G_IS_DIR_SEPARATOR()</title>
<indexterm zone="G-IS-DIR-SEPARATOR:CAPS" role="2.6"><primary sortas="IS_DIR_SEPARATOR">G_IS_DIR_SEPARATOR</primary></indexterm>
<programlisting language="C">#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/')
</programlisting>
<para>Checks whether a character is a directory
separator. It returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> for '/' on UNIX
machines and for '\' or '/' under Windows.</para>
<refsect3 id="G-IS-DIR-SEPARATOR.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>c</para></entry>
<entry role="parameter_description"><para>a character</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.6">2.6</link></para></refsect2>
<refsect2 id="MIN:CAPS" role="macro">
<title>MIN()</title>
<indexterm zone="MIN:CAPS"><primary>MIN</primary></indexterm>
<programlisting language="C">#define MIN(a, b)  (((a) &lt; (b)) ? (a) : (b))
</programlisting>
<para>Calculates the minimum of <parameter>a</parameter>
 and <parameter>b</parameter>
.</para>
<refsect3 id="MIN.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>a</para></entry>
<entry role="parameter_description"><para>a numeric value</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>b</para></entry>
<entry role="parameter_description"><para>a numeric value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="MIN.returns" role="returns">
<title>Returns</title>
<para> the minimum of <parameter>a</parameter>
and <parameter>b</parameter>
.</para>
</refsect3></refsect2>
<refsect2 id="MAX:CAPS" role="macro">
<title>MAX()</title>
<indexterm zone="MAX:CAPS"><primary>MAX</primary></indexterm>
<programlisting language="C">#define MAX(a, b)  (((a) &gt; (b)) ? (a) : (b))
</programlisting>
<para>Calculates the maximum of <parameter>a</parameter>
 and <parameter>b</parameter>
.</para>
<refsect3 id="MAX.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>a</para></entry>
<entry role="parameter_description"><para>a numeric value</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>b</para></entry>
<entry role="parameter_description"><para>a numeric value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="MAX.returns" role="returns">
<title>Returns</title>
<para> the maximum of <parameter>a</parameter>
and <parameter>b</parameter>
.</para>
</refsect3></refsect2>
<refsect2 id="ABS:CAPS" role="macro">
<title>ABS()</title>
<indexterm zone="ABS:CAPS"><primary>ABS</primary></indexterm>
<programlisting language="C">#define ABS(a)	   (((a) &lt; 0) ? -(a) : (a))
</programlisting>
<para>Calculates the absolute value of <parameter>a</parameter>
.
The absolute value is simply the number with any negative sign taken away.</para>
<para>For example,</para>
<itemizedlist>
<listitem><para>ABS(-10) is 10.</para></listitem>
<listitem><para>ABS(10) is also 10.</para></listitem>
</itemizedlist>
<refsect3 id="ABS.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>a</para></entry>
<entry role="parameter_description"><para>a numeric value</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="ABS.returns" role="returns">
<title>Returns</title>
<para> the absolute value of <parameter>a</parameter>
.</para>
</refsect3></refsect2>
<refsect2 id="CLAMP:CAPS" role="macro">
<title>CLAMP()</title>
<indexterm zone="CLAMP:CAPS"><primary>CLAMP</primary></indexterm>
<programlisting language="C">#define CLAMP(x, low, high)  (((x) &gt; (high)) ? (high) : (((x) &lt; (low)) ? (low) : (x)))
</programlisting>
<para>Ensures that <parameter>x</parameter>
 is between the limits set by <parameter>low</parameter>
 and <parameter>high</parameter>
. If <parameter>low</parameter>
 is
greater than <parameter>high</parameter>
 the result is undefined.</para>
<para>For example,</para>
<itemizedlist>
<listitem><para>CLAMP(5, 10, 15) is 10.</para></listitem>
<listitem><para>CLAMP(15, 5, 10) is 10.</para></listitem>
<listitem><para>CLAMP(20, 15, 25) is 20.</para></listitem>
</itemizedlist>
<refsect3 id="CLAMP.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>x</para></entry>
<entry role="parameter_description"><para>the value to clamp</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>low</para></entry>
<entry role="parameter_description"><para>the minimum value allowed</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>high</para></entry>
<entry role="parameter_description"><para>the maximum value allowed</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="CLAMP.returns" role="returns">
<title>Returns</title>
<para> the value of <parameter>x</parameter>
clamped to the range between <parameter>low</parameter>
and <parameter>high</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="G-APPROX-VALUE:CAPS" role="macro" condition="since:2.58">
<title>G_APPROX_VALUE()</title>
<indexterm zone="G-APPROX-VALUE:CAPS" role="2.58"><primary sortas="APPROX_VALUE">G_APPROX_VALUE</primary></indexterm>
<programlisting language="C">#define             G_APPROX_VALUE(a, b, epsilon)</programlisting>
<para>Evaluates to a truth value if the absolute difference between <parameter>a</parameter>
 and <parameter>b</parameter>
 is
smaller than <parameter>epsilon</parameter>
, and to a false value otherwise.</para>
<para>For example,</para>
<itemizedlist>
<listitem><para><literal>G_APPROX_VALUE (5, 6, 2)</literal> evaluates to true</para></listitem>
<listitem><para><literal>G_APPROX_VALUE (3.14, 3.15, 0.001)</literal> evaluates to false</para></listitem>
<listitem><para><literal>G_APPROX_VALUE (n, 0.f, FLT_EPSILON)</literal> evaluates to true if <literal>n</literal> is within
the single precision floating point epsilon from zero</para></listitem>
</itemizedlist>
<refsect3 id="G-APPROX-VALUE.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>a</para></entry>
<entry role="parameter_description"><para>a numeric value</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>b</para></entry>
<entry role="parameter_description"><para>a numeric value</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>epsilon</para></entry>
<entry role="parameter_description"><para>a numeric value that expresses the tolerance between <parameter>a</parameter>
and <parameter>b</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-APPROX-VALUE.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the two values are within the desired range</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.58">2.58</link></para></refsect2>
<refsect2 id="G-SIZEOF-MEMBER:CAPS" role="macro" condition="since:2.64">
<title>G_SIZEOF_MEMBER()</title>
<indexterm zone="G-SIZEOF-MEMBER:CAPS" role="2.64"><primary sortas="SIZEOF_MEMBER">G_SIZEOF_MEMBER</primary></indexterm>
<programlisting language="C">#define             G_SIZEOF_MEMBER(struct_type, member)</programlisting>
<para>Returns the size of <parameter>member</parameter>
 in the struct definition without having a
declared instance of <parameter>struct_type</parameter>
.</para>
<refsect3 id="G-SIZEOF-MEMBER.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>struct_type</para></entry>
<entry role="parameter_description"><para>a structure type, e.g. <link linkend="GOutputVector"><type>GOutputVector</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>member</para></entry>
<entry role="parameter_description"><para>a field in the structure, e.g. <literal>size</literal></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-SIZEOF-MEMBER.returns" role="returns">
<title>Returns</title>
<para> the size of <parameter>member</parameter>
in bytes.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.64">2.64</link></para></refsect2>
<refsect2 id="G-STRUCT-MEMBER:CAPS" role="macro">
<title>G_STRUCT_MEMBER()</title>
<indexterm zone="G-STRUCT-MEMBER:CAPS"><primary sortas="STRUCT_MEMBER">G_STRUCT_MEMBER</primary></indexterm>
<programlisting language="C">#define             G_STRUCT_MEMBER(member_type, struct_p, struct_offset)</programlisting>
<para>Returns a member of a structure at a given offset, using the given type.</para>
<refsect3 id="G-STRUCT-MEMBER.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>member_type</para></entry>
<entry role="parameter_description"><para>the type of the struct field</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>struct_p</para></entry>
<entry role="parameter_description"><para>a pointer to a struct</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>struct_offset</para></entry>
<entry role="parameter_description"><para>the offset of the field from the start of the struct,
in bytes</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-STRUCT-MEMBER.returns" role="returns">
<title>Returns</title>
<para> the struct member</para>
</refsect3></refsect2>
<refsect2 id="G-STRUCT-MEMBER-P:CAPS" role="macro">
<title>G_STRUCT_MEMBER_P()</title>
<indexterm zone="G-STRUCT-MEMBER-P:CAPS"><primary sortas="STRUCT_MEMBER_P">G_STRUCT_MEMBER_P</primary></indexterm>
<programlisting language="C">#define             G_STRUCT_MEMBER_P(struct_p, struct_offset)</programlisting>
<para>Returns an untyped pointer to a given offset of a struct.</para>
<refsect3 id="G-STRUCT-MEMBER-P.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>struct_p</para></entry>
<entry role="parameter_description"><para>a pointer to a struct</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>struct_offset</para></entry>
<entry role="parameter_description"><para>the offset from the start of the struct, in bytes</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-STRUCT-MEMBER-P.returns" role="returns">
<title>Returns</title>
<para> an untyped pointer to <parameter>struct_p</parameter>
plus <parameter>struct_offset</parameter>
bytes</para>
</refsect3></refsect2>
<refsect2 id="G-STRUCT-OFFSET:CAPS" role="macro">
<title>G_STRUCT_OFFSET()</title>
<indexterm zone="G-STRUCT-OFFSET:CAPS"><primary sortas="STRUCT_OFFSET">G_STRUCT_OFFSET</primary></indexterm>
<programlisting language="C">#define             G_STRUCT_OFFSET(struct_type, member)</programlisting>
<para>Returns the offset, in bytes, of a member of a struct.</para>
<refsect3 id="G-STRUCT-OFFSET.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>struct_type</para></entry>
<entry role="parameter_description"><para>a structure type, e.g. <link linkend="GtkWidget"><type>GtkWidget</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>member</para></entry>
<entry role="parameter_description"><para>a field in the structure, e.g. <parameter>window</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="G-STRUCT-OFFSET.returns" role="returns">
<title>Returns</title>
<para> the offset of <parameter>member</parameter>
from the start of <parameter>struct_type</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="G-ALIGNOF:CAPS" role="macro" condition="since:2.60">
<title>G_ALIGNOF()</title>
<indexterm zone="G-ALIGNOF:CAPS" role="2.60"><primary sortas="ALIGNOF">G_ALIGNOF</primary></indexterm>
<programlisting language="C">#define G_ALIGNOF(type) _Alignof (type)
</programlisting>
<para>Return the minimal alignment required by the platform ABI for values of the given
type. The address of a variable or struct member of the given type must always be
a multiple of this alignment. For example, most platforms require int variables
to be aligned at a 4-byte boundary, so <literal>G_ALIGNOF (int)</literal> is 4 on most platforms.</para>
<para>Note this is not necessarily the same as the value returned by GCC’s
<literal>__alignof__</literal> operator, which returns the preferred alignment for a type.
The preferred alignment may be a stricter alignment than the minimal
alignment.</para>
<refsect3 id="G-ALIGNOF.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>type</para></entry>
<entry role="parameter_description"><para>a type-name</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.60">2.60</link></para></refsect2>
<refsect2 id="G-N-ELEMENTS:CAPS" role="macro">
<title>G_N_ELEMENTS()</title>
<indexterm zone="G-N-ELEMENTS:CAPS"><primary sortas="N_ELEMENTS">G_N_ELEMENTS</primary></indexterm>
<programlisting language="C">#define G_N_ELEMENTS(arr)		(sizeof (arr) / sizeof ((arr)[0]))
</programlisting>
<para>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.</para>
<refsect3 id="G-N-ELEMENTS.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>arr</para></entry>
<entry role="parameter_description"><para>the array</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="glib-Standard-Macros.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="G-OS-WIN32:CAPS" role="macro">
<title>G_OS_WIN32</title>
<indexterm zone="G-OS-WIN32:CAPS"><primary sortas="OS_WIN32">G_OS_WIN32</primary></indexterm>
<programlisting language="C">#define G_OS_WIN32
</programlisting>
<para>This macro is defined only on Windows. So you can bracket
Windows-specific code in "#ifdef G_OS_WIN32".</para>
</refsect2>
<refsect2 id="G-OS-UNIX:CAPS" role="macro">
<title>G_OS_UNIX</title>
<indexterm zone="G-OS-UNIX:CAPS"><primary sortas="OS_UNIX">G_OS_UNIX</primary></indexterm>
<programlisting language="C">#define G_OS_UNIX
</programlisting>
<para>This macro is defined only on UNIX. So you can bracket
UNIX-specific code in "#ifdef G_OS_UNIX".</para>
</refsect2>
<refsect2 id="G-DIR-SEPARATOR:CAPS" role="macro">
<title>G_DIR_SEPARATOR</title>
<indexterm zone="G-DIR-SEPARATOR:CAPS"><primary sortas="DIR_SEPARATOR">G_DIR_SEPARATOR</primary></indexterm>
<programlisting language="C">#define G_DIR_SEPARATOR '/'
</programlisting>
<para>The directory separator character.
This is '/' on UNIX machines and '\' under Windows.</para>
</refsect2>
<refsect2 id="G-DIR-SEPARATOR-S:CAPS" role="macro">
<title>G_DIR_SEPARATOR_S</title>
<indexterm zone="G-DIR-SEPARATOR-S:CAPS"><primary sortas="DIR_SEPARATOR_S">G_DIR_SEPARATOR_S</primary></indexterm>
<programlisting language="C">#define G_DIR_SEPARATOR_S "/"
</programlisting>
<para>The directory separator as a string.
This is "/" on UNIX machines and "\" under Windows.</para>
</refsect2>
<refsect2 id="G-SEARCHPATH-SEPARATOR:CAPS" role="macro">
<title>G_SEARCHPATH_SEPARATOR</title>
<indexterm zone="G-SEARCHPATH-SEPARATOR:CAPS"><primary sortas="SEARCHPATH_SEPARATOR">G_SEARCHPATH_SEPARATOR</primary></indexterm>
<programlisting language="C">#define G_SEARCHPATH_SEPARATOR ':'
</programlisting>
<para>The search path separator character.
This is ':' on UNIX machines and ';' under Windows.</para>
</refsect2>
<refsect2 id="G-SEARCHPATH-SEPARATOR-S:CAPS" role="macro">
<title>G_SEARCHPATH_SEPARATOR_S</title>
<indexterm zone="G-SEARCHPATH-SEPARATOR-S:CAPS"><primary sortas="SEARCHPATH_SEPARATOR_S">G_SEARCHPATH_SEPARATOR_S</primary></indexterm>
<programlisting language="C">#define G_SEARCHPATH_SEPARATOR_S ":"
</programlisting>
<para>The search path separator as a string.
This is ":" on UNIX machines and ";" under Windows.</para>
</refsect2>
<refsect2 id="TRUE:CAPS" role="macro">
<title>TRUE</title>
<indexterm zone="TRUE:CAPS"><primary>TRUE</primary></indexterm>
<programlisting language="C">#define&#160;TRUE&#160;(!FALSE)
</programlisting>
<para>Defines the <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> value for the <link linkend="gboolean"><type>gboolean</type></link> type.</para>
</refsect2>
<refsect2 id="FALSE:CAPS" role="macro">
<title>FALSE</title>
<indexterm zone="FALSE:CAPS"><primary>FALSE</primary></indexterm>
<programlisting language="C">#define&#160;FALSE&#160;(0)
</programlisting>
<para>Defines the <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> value for the <link linkend="gboolean"><type>gboolean</type></link> type.</para>
</refsect2>
<refsect2 id="NULL:CAPS" role="macro">
<title>NULL</title>
<indexterm zone="NULL:CAPS"><primary>NULL</primary></indexterm>
<programlisting language="C">#  define NULL        (0L)
</programlisting>
<para>Defines the standard <link linkend="NULL:CAPS"><literal>NULL</literal></link> pointer.</para>
</refsect2>
<refsect2 id="G-MEM-ALIGN:CAPS" role="macro">
<title>G_MEM_ALIGN</title>
<indexterm zone="G-MEM-ALIGN:CAPS"><primary sortas="MEM_ALIGN">G_MEM_ALIGN</primary></indexterm>
<programlisting language="C">#  define G_MEM_ALIGN&#160;GLIB_SIZEOF_VOID_P
</programlisting>
<para>Indicates the number of bytes to which memory will be aligned on the
current platform.</para>
</refsect2>
<refsect2 id="G-CONST-RETURN:CAPS" role="macro" condition="deprecated">
<title>G_CONST_RETURN</title>
<indexterm zone="G-CONST-RETURN:CAPS" role="deprecated"><primary sortas="CONST_RETURN">G_CONST_RETURN</primary></indexterm>
<programlisting language="C">#define G_CONST_RETURN GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const)
</programlisting>
<warning><para><literal>G_CONST_RETURN</literal> has been deprecated since version 2.30 and should not be used in newly-written code.</para> <para>API providers should replace all existing uses with
const and API consumers should adjust their code accordingly</para>
</warning>
<para>If <link linkend="G-DISABLE-CONST-RETURNS:CAPS"><literal>G_DISABLE_CONST_RETURNS</literal></link> is defined, this macro expands
to nothing. By default, the macro expands to const. The macro
can be used in place of const for functions that return a value
that should not be modified. The purpose of this macro is to allow
us to turn on const for returned constant strings by default, while
allowing programmers who find that annoying to turn it off. This macro
should only be used for return values and for "out" parameters, it
doesn't make sense for "in" parameters.</para>
</refsect2>

</refsect1>

</refentry>
