⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-standard-macros.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Standard Macros</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.0"><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-Limits-of-Basic-Types.html" title="Limits of Basic Types"><link rel="next" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros"><meta name="generator" content="GTK-Doc V1.4 (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"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-Limits-of-Basic-Types.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-Type-Conversion-Macros.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="glib-Standard-Macros"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">Standard Macros</span></h2><p>Standard Macros &#8212; commonly-used macros.</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include &lt;glib.h&gt;#define     <a href="glib-Standard-Macros.html#G-OS-WIN32:CAPS">G_OS_WIN32</a>#define     <a href="glib-Standard-Macros.html#G-OS-BEOS:CAPS">G_OS_BEOS</a>#define     <a href="glib-Standard-Macros.html#G-OS-UNIX:CAPS">G_OS_UNIX</a>#define     <a href="glib-Standard-Macros.html#G-DIR-SEPARATOR:CAPS">G_DIR_SEPARATOR</a>#define     <a href="glib-Standard-Macros.html#G-DIR-SEPARATOR-S:CAPS">G_DIR_SEPARATOR_S</a>#define     <a href="glib-Standard-Macros.html#G-IS-DIR-SEPARATOR:CAPS">G_IS_DIR_SEPARATOR</a>              (c)#define     <a href="glib-Standard-Macros.html#G-SEARCHPATH-SEPARATOR:CAPS">G_SEARCHPATH_SEPARATOR</a>#define     <a href="glib-Standard-Macros.html#G-SEARCHPATH-SEPARATOR-S:CAPS">G_SEARCHPATH_SEPARATOR_S</a>#define     <a href="glib-Standard-Macros.html#TRUE:CAPS">TRUE</a>#define     <a href="glib-Standard-Macros.html#FALSE:CAPS">FALSE</a>#define     <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a>#define     <a href="glib-Standard-Macros.html#MIN:CAPS">MIN</a>                             (a, b)#define     <a href="glib-Standard-Macros.html#MAX:CAPS">MAX</a>                             (a, b)#define     <a href="glib-Standard-Macros.html#ABS:CAPS">ABS</a>                             (a)#define     <a href="glib-Standard-Macros.html#CLAMP:CAPS">CLAMP</a>                           (x, low, high)#define     <a href="glib-Standard-Macros.html#G-STRUCT-MEMBER:CAPS">G_STRUCT_MEMBER</a>                 (member_type, struct_p, struct_offset)#define     <a href="glib-Standard-Macros.html#G-STRUCT-MEMBER-P:CAPS">G_STRUCT_MEMBER_P</a>               (struct_p, struct_offset)#define     <a href="glib-Standard-Macros.html#G-STRUCT-OFFSET:CAPS">G_STRUCT_OFFSET</a>                 (struct_type, member)#define     <a href="glib-Standard-Macros.html#G-MEM-ALIGN:CAPS">G_MEM_ALIGN</a>#define     <a href="glib-Standard-Macros.html#G-CONST-RETURN:CAPS">G_CONST_RETURN</a></pre></div><div class="refsect1" lang="en"><a name="id2824398"></a><h2>Description</h2><p>These macros provide a few commonly-used features.</p></div><div class="refsect1" lang="en"><a name="id2824409"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2824414"></a><h3><a name="G-OS-WIN32:CAPS"></a>G_OS_WIN32</h3><a class="indexterm" name="id2824424"></a><pre class="programlisting">#define G_OS_WIN32</pre><p>This macro is defined only on Windows. So you can bracketWindows-specific code in "#ifdef G_OS_WIN32".</p></div><hr><div class="refsect2" lang="en"><a name="id2824447"></a><h3><a name="G-OS-BEOS:CAPS"></a>G_OS_BEOS</h3><a class="indexterm" name="id2824451"></a><pre class="programlisting">#define G_OS_BEOS</pre><p>This macro is defined only on BeOS. So you can bracketBeOS-specific code in "#ifdef G_OS_BEOS".</p></div><hr><div class="refsect2" lang="en"><a name="id2824465"></a><h3><a name="G-OS-UNIX:CAPS"></a>G_OS_UNIX</h3><a class="indexterm" name="id2824478"></a><pre class="programlisting">#define G_OS_UNIX</pre><p>This macro is defined only on UNIX. So you can bracketUNIX-specific code in "#ifdef G_OS_UNIX".</p></div><hr><div class="refsect2" lang="en"><a name="id2824495"></a><h3><a name="G-DIR-SEPARATOR:CAPS"></a>G_DIR_SEPARATOR</h3><a class="indexterm" name="id2824510"></a><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" lang="en"><a name="id2824526"></a><h3><a name="G-DIR-SEPARATOR-S:CAPS"></a>G_DIR_SEPARATOR_S</h3><a class="indexterm" name="id2824536"></a><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" lang="en"><a name="id2824553"></a><h3><a name="G-IS-DIR-SEPARATOR:CAPS"></a>G_IS_DIR_SEPARATOR()</h3><a class="indexterm" name="id2824563"></a><pre class="programlisting">#define     G_IS_DIR_SEPARATOR(c)</pre><p>Checks whether a character is a directory separator. It returns <code class="literal">TRUE</code> for '/' on UNIXmachines and for '\' or '/' under Windows.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>c</code></em>&#160;:</span></td><td>a character</td></tr></tbody></table></div><p>Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id2824609"></a><h3><a name="G-SEARCHPATH-SEPARATOR:CAPS"></a>G_SEARCHPATH_SEPARATOR</h3><a class="indexterm" name="id2824620"></a><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" lang="en"><a name="id2824638"></a><h3><a name="G-SEARCHPATH-SEPARATOR-S:CAPS"></a>G_SEARCHPATH_SEPARATOR_S</h3><a class="indexterm" name="id2824650"></a><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" lang="en"><a name="id2824666"></a><h3><a name="TRUE:CAPS"></a>TRUE</h3><a class="indexterm" name="id2824676"></a><pre class="programlisting">#define	TRUE	(!FALSE)</pre><p>Defines the <code class="literal">TRUE</code> value for the <a href="glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> type.</p></div><hr><div class="refsect2" lang="en"><a name="id2824706"></a><h3><a name="FALSE:CAPS"></a>FALSE</h3><a class="indexterm" name="id2824715"></a><pre class="programlisting">#define	FALSE	(0)</pre><p>Defines the <code class="literal">FALSE</code> value for the <a href="glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> type.</p></div><hr><div class="refsect2" lang="en"><a name="id2824745"></a><h3><a name="NULL:CAPS"></a>NULL</h3><a class="indexterm" name="id2824755"></a><pre class="programlisting">#define     NULL</pre><p>Defines the standard <code class="literal">NULL</code> pointer.</p></div><hr><div class="refsect2" lang="en"><a name="id2824777"></a><h3><a name="MIN:CAPS"></a>MIN()</h3><a class="indexterm" name="id2824787"></a><pre class="programlisting">#define MIN(a, b)  (((a) &lt; (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="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>a</code></em>&#160;:</span></td><td>a numeric value.</td></tr><tr><td><span class="term"><em class="parameter"><code>b</code></em>&#160;:</span></td><td>a numeric value.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>the minimum of <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2824868"></a><h3><a name="MAX:CAPS"></a>MAX()</h3><a class="indexterm" name="id2824877"></a><pre class="programlisting">#define MAX(a, b)  (((a) &gt; (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="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>a</code></em>&#160;:</span></td><td>a numeric value.</td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -