⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.83
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
libgtk-3-dev
/
glib
/
View File Name :
glib-Standard-Macros.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Standard Macros: GLib Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="GLib Reference Manual"> <link rel="up" href="glib-fundamentals.html" title="GLib Fundamentals"> <link rel="prev" href="glib-Basic-Types.html" title="Basic Types"> <link rel="next" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros"> <meta name="generator" content="GTK-Doc V1.32 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </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="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#glib-Standard-Macros.description" class="shortcut">Description</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="glib-fundamentals.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="glib-Basic-Types.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="glib-Type-Conversion-Macros.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="glib-Standard-Macros"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="glib-Standard-Macros.top_of_page"></a>Standard Macros</span></h2> <p>Standard Macros — commonly-used macros</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="glib-Standard-Macros.functions"></a><h2>Functions</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="functions_proto_type"> <col class="functions_proto_name"> </colgroup> <tbody> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#G-IS-DIR-SEPARATOR:CAPS" title="G_IS_DIR_SEPARATOR()">G_IS_DIR_SEPARATOR</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#MIN:CAPS" title="MIN()">MIN</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#MAX:CAPS" title="MAX()">MAX</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#ABS:CAPS" title="ABS()">ABS</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#CLAMP:CAPS" title="CLAMP()">CLAMP</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#G-APPROX-VALUE:CAPS" title="G_APPROX_VALUE()">G_APPROX_VALUE</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#G-SIZEOF-MEMBER:CAPS" title="G_SIZEOF_MEMBER()">G_SIZEOF_MEMBER</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#G-STRUCT-MEMBER:CAPS" title="G_STRUCT_MEMBER()">G_STRUCT_MEMBER</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#G-STRUCT-MEMBER-P:CAPS" title="G_STRUCT_MEMBER_P()">G_STRUCT_MEMBER_P</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#G-STRUCT-OFFSET:CAPS" title="G_STRUCT_OFFSET()">G_STRUCT_OFFSET</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#G-ALIGNOF:CAPS" title="G_ALIGNOF()">G_ALIGNOF</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Standard-Macros.html#G-N-ELEMENTS:CAPS" title="G_N_ELEMENTS()">G_N_ELEMENTS</a><span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="glib-Standard-Macros.other"></a><h2>Types and Values</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="other_proto_type"> <col class="other_proto_name"> </colgroup> <tbody> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#G-OS-WIN32:CAPS" title="G_OS_WIN32">G_OS_WIN32</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#G-OS-UNIX:CAPS" title="G_OS_UNIX">G_OS_UNIX</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#G-DIR-SEPARATOR:CAPS" title="G_DIR_SEPARATOR">G_DIR_SEPARATOR</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#G-DIR-SEPARATOR-S:CAPS" title="G_DIR_SEPARATOR_S">G_DIR_SEPARATOR_S</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#G-SEARCHPATH-SEPARATOR:CAPS" title="G_SEARCHPATH_SEPARATOR">G_SEARCHPATH_SEPARATOR</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#G-SEARCHPATH-SEPARATOR-S:CAPS" title="G_SEARCHPATH_SEPARATOR_S">G_SEARCHPATH_SEPARATOR_S</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE">TRUE</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE">FALSE</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL">NULL</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#G-MEM-ALIGN:CAPS" title="G_MEM_ALIGN">G_MEM_ALIGN</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Standard-Macros.html#G-CONST-RETURN:CAPS" title="G_CONST_RETURN">G_CONST_RETURN</a></td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="glib-Standard-Macros.includes"></a><h2>Includes</h2> <pre class="synopsis">#include <glib.h> </pre> </div> <div class="refsect1"> <a name="glib-Standard-Macros.description"></a><h2>Description</h2> <p>These macros provide a few commonly-used features.</p> </div> <div class="refsect1"> <a name="glib-Standard-Macros.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="G-IS-DIR-SEPARATOR:CAPS"></a><h3>G_IS_DIR_SEPARATOR()</h3> <pre class="programlisting">#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/') </pre> <p>Checks whether a character is a directory separator. It returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> for '/' on UNIX machines and for '\' or '/' under Windows.</p> <div class="refsect3"> <a name="G-IS-DIR-SEPARATOR.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <p class="since">Since: <a class="link" href="api-index-2-6.html#api-index-2.6">2.6</a></p> </div> <hr> <div class="refsect2"> <a name="MIN:CAPS"></a><h3>MIN()</h3> <pre class="programlisting">#define MIN(a, b) (((a) < (b)) ? (a) : (b)) </pre> <p>Calculates the minimum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> .</p> <div class="refsect3"> <a name="MIN.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>a</p></td> <td class="parameter_description"><p>a numeric value</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>b</p></td> <td class="parameter_description"><p>a numeric value</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="MIN.returns"></a><h4>Returns</h4> <p> the minimum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> .</p> </div> </div> <hr> <div class="refsect2"> <a name="MAX:CAPS"></a><h3>MAX()</h3> <pre class="programlisting">#define MAX(a, b) (((a) > (b)) ? (a) : (b)) </pre> <p>Calculates the maximum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> .</p> <div class="refsect3"> <a name="MAX.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>a</p></td> <td class="parameter_description"><p>a numeric value</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>b</p></td> <td class="parameter_description"><p>a numeric value</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="MAX.returns"></a><h4>Returns</h4> <p> the maximum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> .</p> </div> </div> <hr> <div class="refsect2"> <a name="ABS:CAPS"></a><h3>ABS()</h3> <pre class="programlisting">#define ABS(a) (((a) < 0) ? -(a) : (a)) </pre> <p>Calculates the absolute value of <em class="parameter"><code>a</code></em> . The absolute value is simply the number with any negative sign taken away.</p> <p>For example,</p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p>ABS(-10) is 10.</p></li> <li class="listitem"><p>ABS(10) is also 10.</p></li> </ul></div> <div class="refsect3"> <a name="ABS.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>a</p></td> <td class="parameter_description"><p>a numeric value</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="ABS.returns"></a><h4>Returns</h4> <p> the absolute value of <em class="parameter"><code>a</code></em> .</p> </div> </div> <hr> <div class="refsect2"> <a name="CLAMP:CAPS"></a><h3>CLAMP()</h3> <pre class="programlisting">#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) </pre> <p>Ensures that <em class="parameter"><code>x</code></em> is between the limits set by <em class="parameter"><code>low</code></em> and <em class="parameter"><code>high</code></em> . If <em class="parameter"><code>low</code></em> is greater than <em class="parameter"><code>high</code></em> the result is undefined.</p> <p>For example,</p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p>CLAMP(5, 10, 15) is 10.</p></li> <li class="listitem"><p>CLAMP(15, 5, 10) is 10.</p></li> <li class="listitem"><p>CLAMP(20, 15, 25) is 20.</p></li> </ul></div> <div class="refsect3"> <a name="CLAMP.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>x</p></td> <td class="parameter_description"><p>the value to clamp</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>low</p></td> <td class="parameter_description"><p>the minimum value allowed</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>high</p></td> <td class="parameter_description"><p>the maximum value allowed</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="CLAMP.returns"></a><h4>Returns</h4> <p> the value of <em class="parameter"><code>x</code></em> clamped to the range between <em class="parameter"><code>low</code></em> and <em class="parameter"><code>high</code></em> </p> </div> </div> <hr> <div class="refsect2"> <a name="G-APPROX-VALUE:CAPS"></a><h3>G_APPROX_VALUE()</h3> <pre class="programlisting">#define G_APPROX_VALUE(a, b, epsilon)</pre> <p>Evaluates to a truth value if the absolute difference between <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> is smaller than <em class="parameter"><code>epsilon</code></em> , and to a false value otherwise.</p> <p>For example,</p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p><code class="literal">G_APPROX_VALUE (5, 6, 2)</code> evaluates to true</p></li> <li class="listitem"><p><code class="literal">G_APPROX_VALUE (3.14, 3.15, 0.001)</code> evaluates to false</p></li> <li class="listitem"><p><code class="literal">G_APPROX_VALUE (n, 0.f, FLT_EPSILON)</code> evaluates to true if <code class="literal">n</code> is within the single precision floating point epsilon from zero</p></li> </ul></div> <div class="refsect3"> <a name="G-APPROX-VALUE.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>a</p></td> <td class="parameter_description"><p>a numeric value</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>b</p></td> <td class="parameter_description"><p>a numeric value</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>epsilon</p></td> <td class="parameter_description"><p>a numeric value that expresses the tolerance between <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="G-APPROX-VALUE.returns"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the two values are within the desired range</p> </div> <p class="since">Since: <a class="link" href="api-index-2-58.html#api-index-2.58">2.58</a></p> </div> <hr> <div class="refsect2"> <a name="G-SIZEOF-MEMBER:CAPS"></a><h3>G_SIZEOF_MEMBER()</h3> <pre class="programlisting">#define G_SIZEOF_MEMBER(struct_type, member)</pre> <p>Returns the size of <em class="parameter"><code>member</code></em> in the struct definition without having a declared instance of <em class="parameter"><code>struct_type</code></em> .</p> <div class="refsect3"> <a name="G-SIZEOF-MEMBER.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>struct_type</p></td> <td class="parameter_description"><p>a structure type, e.g. <span class="type">GOutputVector</span></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>member</p></td> <td class="parameter_description"><p>a field in the structure, e.g. <code class="literal">size</code></p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="G-SIZEOF-MEMBER.returns"></a><h4>Returns</h4> <p> the size of <em class="parameter"><code>member</code></em> in bytes.</p> </div> <p class="since">Since: <a class="link" href="api-index-2-64.html#api-index-2.64">2.64</a></p> </div> <hr> <div class="refsect2"> <a name="G-STRUCT-MEMBER:CAPS"></a><h3>G_STRUCT_MEMBER()</h3> <pre class="programlisting">#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset)</pre> <p>Returns a member of a structure at a given offset, using the given type.</p> <div class="refsect3"> <a name="G-STRUCT-MEMBER.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>member_type</p></td> <td class="parameter_description"><p>the type of the struct field</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>struct_p</p></td> <td class="parameter_description"><p>a pointer to a struct</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>struct_offset</p></td> <td class="parameter_description"><p>the offset of the field from the start of the struct, in bytes</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="G-STRUCT-MEMBER.returns"></a><h4>Returns</h4> <p> the struct member</p> </div> </div> <hr> <div class="refsect2"> <a name="G-STRUCT-MEMBER-P:CAPS"></a><h3>G_STRUCT_MEMBER_P()</h3> <pre class="programlisting">#define G_STRUCT_MEMBER_P(struct_p, struct_offset)</pre> <p>Returns an untyped pointer to a given offset of a struct.</p> <div class="refsect3"> <a name="G-STRUCT-MEMBER-P.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>struct_p</p></td> <td class="parameter_description"><p>a pointer to a struct</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>struct_offset</p></td> <td class="parameter_description"><p>the offset from the start of the struct, in bytes</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="G-STRUCT-MEMBER-P.returns"></a><h4>Returns</h4> <p> an untyped pointer to <em class="parameter"><code>struct_p</code></em> plus <em class="parameter"><code>struct_offset</code></em> bytes</p> </div> </div> <hr> <div class="refsect2"> <a name="G-STRUCT-OFFSET:CAPS"></a><h3>G_STRUCT_OFFSET()</h3> <pre class="programlisting">#define G_STRUCT_OFFSET(struct_type, member)</pre> <p>Returns the offset, in bytes, of a member of a struct.</p> <div class="refsect3"> <a name="G-STRUCT-OFFSET.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>struct_type</p></td> <td class="parameter_description"><p>a structure type, e.g. <span class="type">GtkWidget</span></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>member</p></td> <td class="parameter_description"><p>a field in the structure, e.g. <em class="parameter"><code>window</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="G-STRUCT-OFFSET.returns"></a><h4>Returns</h4> <p> the offset of <em class="parameter"><code>member</code></em> from the start of <em class="parameter"><code>struct_type</code></em> </p> </div> </div> <hr> <div class="refsect2"> <a name="G-ALIGNOF:CAPS"></a><h3>G_ALIGNOF()</h3> <pre class="programlisting">#define G_ALIGNOF(type) _Alignof (type) </pre> <p>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 <code class="literal">G_ALIGNOF (int)</code> is 4 on most platforms.</p> <p>Note this is not necessarily the same as the value returned by GCC’s <code class="literal">__alignof__</code> operator, which returns the preferred alignment for a type. The preferred alignment may be a stricter alignment than the minimal alignment.</p> <div class="refsect3"> <a name="G-ALIGNOF.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>a type-name</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <p class="since">Since: <a class="link" href="api-index-2-60.html#api-index-2.60">2.60</a></p> </div> <hr> <div class="refsect2"> <a name="G-N-ELEMENTS:CAPS"></a><h3>G_N_ELEMENTS()</h3> <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="refsect3"> <a name="G-N-ELEMENTS.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>arr</p></td> <td class="parameter_description"><p>the array</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> </div> </div> <div class="refsect1"> <a name="glib-Standard-Macros.other_details"></a><h2>Types and Values</h2> <div class="refsect2"> <a name="G-OS-WIN32:CAPS"></a><h3>G_OS_WIN32</h3> <pre class="programlisting">#define G_OS_WIN32 </pre> <p>This macro is defined only on Windows. So you can bracket Windows-specific code in "#ifdef G_OS_WIN32".</p> </div> <hr> <div class="refsect2"> <a name="G-OS-UNIX:CAPS"></a><h3>G_OS_UNIX</h3> <pre class="programlisting">#define G_OS_UNIX </pre> <p>This macro is defined only on UNIX. So you can bracket UNIX-specific code in "#ifdef G_OS_UNIX".</p> </div> <hr> <div class="refsect2"> <a name="G-DIR-SEPARATOR:CAPS"></a><h3>G_DIR_SEPARATOR</h3> <pre class="programlisting">#define G_DIR_SEPARATOR '/' </pre> <p>The directory separator character. This is '/' on UNIX machines and '\' under Windows.</p> </div> <hr> <div class="refsect2"> <a name="G-DIR-SEPARATOR-S:CAPS"></a><h3>G_DIR_SEPARATOR_S</h3> <pre class="programlisting">#define G_DIR_SEPARATOR_S "/" </pre> <p>The directory separator as a string. This is "/" on UNIX machines and "\" under Windows.</p> </div> <hr> <div class="refsect2"> <a name="G-SEARCHPATH-SEPARATOR:CAPS"></a><h3>G_SEARCHPATH_SEPARATOR</h3> <pre class="programlisting">#define G_SEARCHPATH_SEPARATOR ':' </pre> <p>The search path separator character. This is ':' on UNIX machines and ';' under Windows.</p> </div> <hr> <div class="refsect2"> <a name="G-SEARCHPATH-SEPARATOR-S:CAPS"></a><h3>G_SEARCHPATH_SEPARATOR_S</h3> <pre class="programlisting">#define G_SEARCHPATH_SEPARATOR_S ":" </pre> <p>The search path separator as a string. This is ":" on UNIX machines and ";" under Windows.</p> </div> <hr> <div class="refsect2"> <a name="TRUE:CAPS"></a><h3>TRUE</h3> <pre class="programlisting">#define TRUE (!FALSE) </pre> <p>Defines the <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> value for the <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> type.</p> </div> <hr> <div class="refsect2"> <a name="FALSE:CAPS"></a><h3>FALSE</h3> <pre class="programlisting">#define FALSE (0) </pre> <p>Defines the <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> value for the <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> type.</p> </div> <hr> <div class="refsect2"> <a name="NULL:CAPS"></a><h3>NULL</h3> <pre class="programlisting"># define NULL (0L) </pre> <p>Defines the standard <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> pointer.</p> </div> <hr> <div class="refsect2"> <a name="G-MEM-ALIGN:CAPS"></a><h3>G_MEM_ALIGN</h3> <pre class="programlisting"># define G_MEM_ALIGN GLIB_SIZEOF_VOID_P </pre> <p>Indicates the number of bytes to which memory will be aligned on the current platform.</p> </div> <hr> <div class="refsect2"> <a name="G-CONST-RETURN:CAPS"></a><h3>G_CONST_RETURN</h3> <pre class="programlisting">#define G_CONST_RETURN GLIB_DEPRECATED_MACRO_IN_2_30_FOR(const) </pre> <div class="warning"> <p><code class="literal">G_CONST_RETURN</code> has been deprecated since version 2.30 and should not be used in newly-written code.</p> <p>API providers should replace all existing uses with const and API consumers should adjust their code accordingly</p> </div> <p>If <code class="literal">G_DISABLE_CONST_RETURNS</code> 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.</p> </div> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.32</div> </body> </html>