?? glib-warnings-and-assertions.html
字號(hào):
<col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td><td>the expression to check.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2954586"></a><h3><a name="g-return-val-if-fail"></a>g_return_val_if_fail()</h3><a class="indexterm" name="id2954599"></a><pre class="programlisting">#define g_return_val_if_fail(expr,val)</pre><p>Returns from the current function, returning the value <em class="parameter"><code>val</code></em>, if the expressionis not true.If the expression evaluates to <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, a critical message is logged and<em class="parameter"><code>val</code></em> is returned.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td><td>the expression to check.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>val</code></em> :</span></p></td><td>the value to return from the current function if the expression is nottrue.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2954672"></a><h3><a name="g-return-if-reached"></a>g_return_if_reached()</h3><a class="indexterm" name="id2954686"></a><pre class="programlisting">#define g_return_if_reached()</pre><p>Logs a critical message and returns from the current function. This can only be used in functions which do not return a value.</p></div><hr><div class="refsect2" lang="en"><a name="id2954703"></a><h3><a name="g-return-val-if-reached"></a>g_return_val_if_reached()</h3><a class="indexterm" name="id2954716"></a><pre class="programlisting">#define g_return_val_if_reached(val)</pre><p>Logs a critical message and returns <em class="parameter"><code>val</code></em>. </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>val</code></em> :</span></p></td><td>the value to return from the current function.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2954757"></a><h3><a name="g-warn-if-fail"></a>g_warn_if_fail()</h3><a class="indexterm" name="id2954770"></a><pre class="programlisting">#define g_warn_if_fail(expr)</pre><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td><td></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2954803"></a><h3><a name="g-warn-if-reached"></a>g_warn_if_reached()</h3><a class="indexterm" name="id2954816"></a><pre class="programlisting">#define g_warn_if_reached()</pre><p></p></div><hr><div class="refsect2" lang="en"><a name="id2954832"></a><h3><a name="g-warn-message"></a>g_warn_message ()</h3><a class="indexterm" name="id2954844"></a><pre class="programlisting">void g_warn_message (const char *domain, const char *file, int line, const char *func, const char *warnexpr);</pre><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td><td></td></tr><tr><td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td><td></td></tr><tr><td><p><span class="term"><em class="parameter"><code>line</code></em> :</span></p></td><td></td></tr><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td></td></tr><tr><td><p><span class="term"><em class="parameter"><code>warnexpr</code></em> :</span></p></td><td></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2954976"></a><h3><a name="g-on-error-query"></a>g_on_error_query ()</h3><a class="indexterm" name="id2954988"></a><pre class="programlisting">void g_on_error_query (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *prg_name);</pre><p>Prompts the user with <code class="computeroutput">[E]xit, [H]alt, show [S]tack trace or [P]roceed</code>.This function is intended to be used for debugging use only. The followingexample shows how it can be used together with the <a class="link" href="glib-Message-Logging.html#g-log"><code class="function">g_log()</code></a> functions.</p><div class="informalexample"><pre class="programlisting">#include <glib.h>static void log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data){ g_log_default_handler (log_domain, log_level, message, user_data); g_on_error_query (MY_PROGRAM_NAME);}int main (int argc, char *argv[]){ g_log_set_handler (MY_LOG_DOMAIN, G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL, log_handler, NULL); /* ... */ </pre></div><p>If [E]xit is selected, the application terminates with a call to<code class="function">_exit(0)</code>.</p><p>If [H]alt is selected, the application enters an infinite loop.The infinite loop can only be stopped by killing the application,or by setting <span class="type">glib_on_error_halt</span> to <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> (possibly via a debugger).</p><p>If [S]tack trace is selected, <a class="link" href="glib-Warnings-and-Assertions.html#g-on-error-stack-trace"><code class="function">g_on_error_stack_trace()</code></a> is called. Thisinvokes <span class="command"><strong>gdb</strong></span>, which attaches to the current process and shows a stack trace.The prompt is then shown again.</p><p>If [P]roceed is selected, the function returns.</p><p>This function may cause different actions on non-UNIX platforms.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>prg_name</code></em> :</span></p></td><td>the program name, needed by <span class="command"><strong>gdb</strong></span> for the [S]tack trace option.If <em class="parameter"><code>prg_name</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-get-prgname"><code class="function">g_get_prgname()</code></a> is called to get the program name(which will work correctly if <ahref="/usr/share/gtk-doc/html/gdk/gdk-General.html#gdk-init"><code class="function">gdk_init()</code></a> or <ahref="/usr/share/gtk-doc/html/gtk/gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a> has been called).</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2955205"></a><h3><a name="g-on-error-stack-trace"></a>g_on_error_stack_trace ()</h3><a class="indexterm" name="id2955219"></a><pre class="programlisting">void g_on_error_stack_trace (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *prg_name);</pre><p>Invokes <span class="command"><strong>gdb</strong></span>, which attaches to the current process and shows a stack trace.Called by <a class="link" href="glib-Warnings-and-Assertions.html#g-on-error-query"><code class="function">g_on_error_query()</code></a> when the [S]tack trace option is selected.</p><p>This function may cause different actions on non-UNIX platforms.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>prg_name</code></em> :</span></p></td><td>the program name, needed by <span class="command"><strong>gdb</strong></span> for the [S]tack trace option.If <em class="parameter"><code>prg_name</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-get-prgname"><code class="function">g_get_prgname()</code></a> is called to get the program name(which will work correctly if <ahref="/usr/share/gtk-doc/html/gdk/gdk-General.html#gdk-init"><code class="function">gdk_init()</code></a> or <ahref="/usr/share/gtk-doc/html/gtk/gtk-General.html#gtk-init"><code class="function">gtk_init()</code></a> has been called).</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2955343"></a><h3><a name="G-BREAKPOINT:CAPS"></a>G_BREAKPOINT()</h3><a class="indexterm" name="id2955356"></a><pre class="programlisting">#define G_BREAKPOINT()</pre><p>Inserts a breakpoint instruction into the code. On x86 and alpha systemsthis is implemented as a soft interrupt and on other architectures it raisesa <code class="literal">SIGTRAP</code> signal.</p></div></div><div class="refsect1" lang="en"><a name="id2955387"></a><div class="refsect2" lang="en"><a name="id2955388"></a></div><hr><div class="refsect2" lang="en"><a name="id2955389"></a></div></div></div></body></html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -