亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? glib-error-reporting.html

?? 最新gtk中文資料集
?? HTML
?? 第 1 頁 / 共 3 頁
字號:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>Error Reporting</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib-core.html" title="GLib Core Application Support"><link rel="prev" href="glib-IO-Channels.html" title="IO Channels"><link rel="next" href="glib-Warnings-and-Assertions.html" title="Message Output and Debugging Functions"><meta name="generator" content="GTK-Doc V1.9 (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"><link rel="index" href="ix09.html" title="Index of new symbols in 2.14"><link rel="index" href="ix10.html" title="Index of new symbols in 2.16"></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-IO-Channels.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-core.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-Warnings-and-Assertions.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="#id2946927" class="shortcut">Top</a>                  &#160;|&#160;                  <a href="#id2947282" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="glib-Error-Reporting"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id2946927"></a><span class="refentrytitle">Error Reporting</span></h2><p>Error Reporting &#8212; a system for reporting errors</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;                    <a class="link" href="glib-Error-Reporting.html#GError">GError</a>;<a class="link" href="glib-Error-Reporting.html#GError">GError</a>*             <a class="link" href="glib-Error-Reporting.html#g-error-new">g_error_new</a>                         (<a class="link" href="glib-Quarks.html#GQuark">GQuark</a> domain,                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> code,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *format,                                                         ...);<a class="link" href="glib-Error-Reporting.html#GError">GError</a>*             <a class="link" href="glib-Error-Reporting.html#g-error-new-literal">g_error_new_literal</a>                 (<a class="link" href="glib-Quarks.html#GQuark">GQuark</a> domain,                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> code,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *message);void                <a class="link" href="glib-Error-Reporting.html#g-error-free">g_error_free</a>                        (<a class="link" href="glib-Error-Reporting.html#GError">GError</a> *error);<a class="link" href="glib-Error-Reporting.html#GError">GError</a>*             <a class="link" href="glib-Error-Reporting.html#g-error-copy">g_error_copy</a>                        (const <a class="link" href="glib-Error-Reporting.html#GError">GError</a> *error);<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-Error-Reporting.html#g-error-matches">g_error_matches</a>                     (const <a class="link" href="glib-Error-Reporting.html#GError">GError</a> *error,                                                         <a class="link" href="glib-Quarks.html#GQuark">GQuark</a> domain,                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> code);void                <a class="link" href="glib-Error-Reporting.html#g-set-error">g_set_error</a>                         (<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **err,                                                         <a class="link" href="glib-Quarks.html#GQuark">GQuark</a> domain,                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> code,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *format,                                                         ...);void                <a class="link" href="glib-Error-Reporting.html#g-propagate-error">g_propagate_error</a>                   (<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **dest,                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> *src);void                <a class="link" href="glib-Error-Reporting.html#g-clear-error">g_clear_error</a>                       (<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **err);void                <a class="link" href="glib-Error-Reporting.html#g-prefix-error">g_prefix_error</a>                      (<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **err,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *format,                                                         ...);void                <a class="link" href="glib-Error-Reporting.html#g-propagate-prefixed-error">g_propagate_prefixed_error</a>          (<a class="link" href="glib-Error-Reporting.html#GError">GError</a> **dest,                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> *src,                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *format,                                                         ...);</pre></div><div class="refsect1" lang="en"><a name="id2947282"></a><h2>Description</h2><p>GLib provides a standard method of reporting errors from a called function tothe calling code. (This is the same problem solved by exceptions in otherlanguages.) It's important to understand that this method is both a<span class="emphasis"><em>data type</em></span> (the <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> object) and a <span class="emphasis"><em>set ofrules.</em></span> If you use <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> incorrectly, then your code will notproperly interoperate with other code that uses <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, and users of your APIwill probably get confused.</p><p>First and foremost: <span class="emphasis"><em><a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> should only be used to reportrecoverable runtime errors, never to report programming errors.</em></span> Ifthe programmer has screwed up, then you should use <a class="link" href="glib-Message-Logging.html#g-warning"><code class="function">g_warning()</code></a>,<a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-fail"><code class="function">g_return_if_fail()</code></a>, <a class="link" href="glib-Testing.html#g-assert"><code class="function">g_assert()</code></a>, <a class="link" href="glib-Message-Logging.html#g-error"><code class="function">g_error()</code></a>, or some similar facility.(Incidentally, remember that the <a class="link" href="glib-Message-Logging.html#g-error"><code class="function">g_error()</code></a> function should<span class="emphasis"><em>only</em></span> be used for programming errors, it should not be usedto print any error reportable via <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.)</p><p>Examples of recoverable runtime errors are "file not found" or "failed to parseinput." Examples of programming errors are "NULL passed to <code class="function">strcmp()</code>" or"attempted to free the same pointer twice." These two kinds of errors arefundamentally different: runtime errors should be handled or reported to theuser, programming errors should be eliminated by fixing the bug in the program.This is why most functions in GLib and GTK+ do not use the <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> facility.</p><p>Functions that can fail take a return location for a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> as their last argument. For example:</p><div class="informalexample"><pre class="programlisting">gboolean g_file_get_contents (const gchar *filename, 	                      gchar      **contents,                              gsize       *length,                              GError     **error);</pre></div><p>If you pass a non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> value for the <code class="literal">error</code> argument, it should point to a location where an error can be placed. For example:</p><div class="informalexample"><pre class="programlisting">gchar *contents;GError *err = NULL;g_file_get_contents ("foo.txt", &amp;contents, NULL, &amp;err);g_assert ((contents == NULL &amp;&amp; err != NULL) || (contents != NULL &amp;&amp; err == NULL));if (err != NULL)  {    /* Report error to user, and free error */    g_assert (contents == NULL);    fprintf (stderr, "Unable to read file: %s\n", err-&gt;message);    g_error_free (err);  } else  {    /* Use file contents */    g_assert (contents != NULL);  }</pre></div><p>Note that <code class="literal">err != NULL</code> in this example is a<span class="emphasis"><em>reliable</em></span> indicator of whether<a class="link" href="glib-File-Utilities.html#g-file-get-contents"><code class="function">g_file_get_contents()</code></a> failed. Additionally, <a class="link" href="glib-File-Utilities.html#g-file-get-contents"><code class="function">g_file_get_contents()</code></a> returnsa boolean which indicates whether it was successful.</p><p>Because <a class="link" href="glib-File-Utilities.html#g-file-get-contents"><code class="function">g_file_get_contents()</code></a> returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on failure, if you are onlyinterested in whether it failed and don't need to display an error message, youcan pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the <code class="literal">error</code> argument:</p><div class="informalexample"><pre class="programlisting">if (g_file_get_contents ("foo.txt", &amp;contents, NULL, NULL)) /* ignore errors */  /* no error occurred */ ;else  /* error */ ;</pre></div><p></p><p>The <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> object contains three fields: <code class="literal">domain</code> indicatesthe module the error-reporting function is located in, <code class="literal">code</code>indicates the specific error that occurred, and <code class="literal">message</code> is auser-readable error message with as many details as possible. Several functionsare provided to deal with an error received from a called function:<a class="link" href="glib-Error-Reporting.html#g-error-matches"><code class="function">g_error_matches()</code></a> returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the error matches a given domain and code,<a class="link" href="glib-Error-Reporting.html#g-propagate-error"><code class="function">g_propagate_error()</code></a> copies an error into an error location (so the callingfunction will receive it), and <a class="link" href="glib-Error-Reporting.html#g-clear-error"><code class="function">g_clear_error()</code></a> clears an error location byfreeing the error and resetting the location to <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. To display an error to theuser, simply display <code class="literal">error-&gt;message</code>, perhaps along withadditional context known only to the calling function (the file being opened, orwhatever -- though in the <a class="link" href="glib-File-Utilities.html#g-file-get-contents"><code class="function">g_file_get_contents()</code></a> case,<code class="literal">error-&gt;message</code> already contains a filename).</p><p>When implementing a function that can report errors, the basic tool is<a class="link" href="glib-Error-Reporting.html#g-set-error"><code class="function">g_set_error()</code></a>. Typically, if a fatal error occurs you want to <a class="link" href="glib-Error-Reporting.html#g-set-error"><code class="function">g_set_error()</code></a>,then return immediately. <a class="link" href="glib-Error-Reporting.html#g-set-error"><code class="function">g_set_error()</code></a> does nothing if the error location passedto it is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Here's an example:</p><div class="informalexample"><pre class="programlisting">gintfoo_open_file (GError **error){  gint fd;  fd = open ("file.txt", O_RDONLY);  if (fd &lt; 0)    {      g_set_error (error,                   FOO_ERROR,                 /* error domain */                   FOO_ERROR_BLAH,            /* error code */                   "Failed to open file: %s", /* error message format string */                   g_strerror (errno));      return -1;    }  else    return fd;}</pre></div><p></p><p>Things are somewhat more complicated if you yourself call another function thatcan report a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>. If the sub-function indicates fatal errors in some wayother than reporting a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, such as by returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, you cansimply do the following:</p><div class="informalexample"><pre class="programlisting">gbooleanmy_function_that_can_fail (GError **err){  g_return_val_if_fail (err == NULL || *err == NULL, FALSE);  if (!sub_function_that_can_fail (err))    {       /* assert that error was set by the sub-function */       g_assert (err == NULL || *err != NULL);         return FALSE;    }  /* otherwise continue, no error occurred */  g_assert (err == NULL || *err == NULL);}</pre></div><p></p><p>If the sub-function does not indicate errors other than by reporting a <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, you need to create a temporary <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> since the passed-in one may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.<a class="link" href="glib-Error-Reporting.html#g-propagate-error"><code class="function">g_propagate_error()</code></a> is intended for use in this case.</p><div class="informalexample"><pre class="programlisting">gbooleanmy_function_that_can_fail (GError **err){  GError *tmp_error;  g_return_val_if_fail (err == NULL || *err == NULL, FALSE);  tmp_error = NULL;  sub_function_that_can_fail (&amp;tmp_error);  if (tmp_error != NULL)    {       /* store tmp_error in err, if err != NULL,        * otherwise call g_error_free() on tmp_error         */       g_propagate_error (err, tmp_error);       return FALSE;    }  /* otherwise continue, no error occurred */}</pre></div><p></p><p>Error pileups are always a bug. For example, this code is incorrect:</p><div class="informalexample"><pre class="programlisting">gbooleanmy_function_that_can_fail (GError **err){  GError *tmp_error;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本成人在线电影网| 日韩成人伦理电影在线观看| 亚洲女同一区二区| 天天色综合天天| 成人动漫一区二区| 欧美成人三级电影在线| 亚洲一卡二卡三卡四卡五卡| 国产成人综合在线观看| 日韩女优电影在线观看| 亚洲一区中文日韩| 成人av网站大全| 2021久久国产精品不只是精品| 亚洲免费观看高清完整版在线观看 | 日韩美女主播在线视频一区二区三区| 国产精品色眯眯| 久久91精品久久久久久秒播| 欧亚一区二区三区| 亚洲色图制服丝袜| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 亚洲视频一区在线| 国产99久久久久久免费看农村| 欧美日韩美少妇| 亚洲综合激情另类小说区| 成人激情小说网站| 国产精品久久久久影视| 懂色av噜噜一区二区三区av| 久久久久久黄色| 韩国av一区二区三区四区| 欧美一级久久久久久久大片| 丝瓜av网站精品一区二区| 91久久一区二区| 亚洲免费视频成人| 99re视频这里只有精品| 综合自拍亚洲综合图不卡区| 色悠悠亚洲一区二区| 亚洲欧美一区二区不卡| 99精品视频在线播放观看| 国产精品欧美一级免费| av一区二区三区四区| 亚洲欧洲日产国码二区| 91蝌蚪porny九色| 亚洲精品成人悠悠色影视| 色欧美片视频在线观看在线视频| 成人欧美一区二区三区小说| 97精品国产97久久久久久久久久久久| 亚洲欧洲99久久| 欧美亚洲一区三区| 视频一区欧美日韩| 欧美精品一区二| 成人永久看片免费视频天堂| 一区在线播放视频| 欧美午夜一区二区三区| 首页亚洲欧美制服丝腿| 欧美不卡一区二区| 成人国产一区二区三区精品| 亚洲精品中文在线影院| 91精品免费在线观看| 国产又粗又猛又爽又黄91精品| 国产欧美一二三区| 欧洲一区二区三区在线| 久久电影网站中文字幕| 国产亚洲欧美日韩在线一区| 色婷婷国产精品| 老司机精品视频线观看86 | 色婷婷av一区二区三区大白胸| 亚洲无线码一区二区三区| 欧美电影免费观看高清完整版在| 成人免费三级在线| 亚洲国产成人高清精品| 久久久久国产成人精品亚洲午夜| 91免费在线看| 久久国产精品第一页| 自拍偷拍亚洲综合| 精品少妇一区二区三区在线播放 | 青娱乐精品在线视频| 国产精品私人自拍| 8x福利精品第一导航| 成人午夜大片免费观看| 天天操天天干天天综合网| 久久蜜桃一区二区| 欧美精品在线视频| 不卡av电影在线播放| 免费成人av在线播放| 一区二区高清在线| 国产欧美综合在线观看第十页| 欧美色综合网站| 99视频精品全部免费在线| 蜜臀久久久久久久| 一区二区三区色| 中文字幕av免费专区久久| 日韩欧美国产午夜精品| 欧美无砖专区一中文字| 99re66热这里只有精品3直播| 久久99国产精品尤物| 亚洲自拍偷拍综合| 国产精品成人网| 久久久亚洲精品一区二区三区| 欧美色图第一页| 91美女在线观看| 波多野结衣视频一区| 国产精品香蕉一区二区三区| 免费的成人av| 青青草一区二区三区| 日韩专区在线视频| 亚洲一区av在线| 一区二区三区四区高清精品免费观看 | 亚洲欧洲韩国日本视频| 国产日韩影视精品| 久久精品夜夜夜夜久久| 欧美mv日韩mv国产| 日韩欧美色电影| 精品少妇一区二区三区免费观看| 欧美夫妻性生活| 欧美一区二区三区白人| 制服视频三区第一页精品| 制服视频三区第一页精品| 亚洲精品一区二区在线观看| 国产在线精品一区二区不卡了| 五月天欧美精品| 一区二区三区蜜桃| 亚洲一区二区三区三| 亚洲美腿欧美偷拍| 亚洲一区二区三区爽爽爽爽爽| 亚洲一区二区三区三| 亚洲国产视频在线| 天涯成人国产亚洲精品一区av| 三级欧美韩日大片在线看| 日韩和欧美的一区| 精品在线视频一区| 国产成人午夜99999| proumb性欧美在线观看| 一道本成人在线| 26uuu久久天堂性欧美| 亚洲国产精品成人综合色在线婷婷| 中文字幕中文字幕一区| 亚洲精品免费在线播放| 香蕉久久夜色精品国产使用方法| 日韩一区欧美二区| 欧美色综合天天久久综合精品| 一本一道波多野结衣一区二区| 欧美亚洲国产一区二区三区va| 欧美日韩一区国产| 精品国产免费一区二区三区四区| 国产欧美一区二区在线| 伊人夜夜躁av伊人久久| 日本三级韩国三级欧美三级| 国产一区999| 色爱区综合激月婷婷| 欧美人牲a欧美精品| 久久久美女艺术照精彩视频福利播放| 国产欧美中文在线| 亚洲成人资源网| 国产精品1024| 欧美午夜精品久久久| 久久综合丝袜日本网| 亚洲综合另类小说| 国产一区二区成人久久免费影院| 91蝌蚪porny| 久久久亚洲欧洲日产国码αv| 亚洲精品欧美专区| 国产伦精品一区二区三区免费| 91久久精品一区二区三| 欧美大片日本大片免费观看| 亚洲日本欧美天堂| 国产美女精品一区二区三区| 日本高清视频一区二区| 久久久久亚洲综合| 天天色天天操综合| 91国产免费观看| 国产午夜亚洲精品午夜鲁丝片| 亚州成人在线电影| 91在线一区二区| 国产蜜臀av在线一区二区三区| 日本成人中文字幕在线视频| 色噜噜狠狠色综合欧洲selulu| 国产片一区二区三区| 捆绑紧缚一区二区三区视频| 欧美视频完全免费看| 国产精品美女久久久久久| 九色综合国产一区二区三区| 国产精品国产精品国产专区不蜜 | 色婷婷综合五月| 国产午夜精品一区二区三区嫩草| 日韩黄色免费电影| 在线免费观看一区| 亚洲视频一区二区在线| 岛国精品在线播放| 久久久久久久久99精品| 蜜桃精品在线观看| 91麻豆精品国产无毒不卡在线观看| 一区二区三区在线观看视频 | 精品午夜一区二区三区在线观看| 欧美日韩一级二级| 亚洲国产aⅴ天堂久久| 91精彩视频在线| 一区二区三区国产| 一本一道久久a久久精品综合蜜臀| 中文字幕一区二区三区在线播放| 成人禁用看黄a在线| 国产精品国产三级国产专播品爱网|