Re: g_assert vs. g_return_if_fail
- From: Behdad Esfahbod <behdad behdad org>
- To: Martin Kalbfuß <ma kalbfuss web de>
- Cc: Gtk+ <gtk-list gnome org>
- Subject: Re: g_assert vs. g_return_if_fail
- Date: Wed, 20 Jan 2010 13:18:14 -0500
On 01/20/2010 02:03 PM, Martin Kalbfuß wrote:
> Thanks,
>
> But why is it a disastrous idea?
>
> When It's a clear programming error, why not abort the program with
> g_assert?
Because that can cause user data loss.
behdad
> Am Mittwoch, den 20.01.2010, 12:23 -0500 schrieb Behdad Esfahbod:
>> On 01/20/2010 12:28 PM, Martin Kalbfuß wrote:
>>> Hi,
>>>
>>> I don't understand the need for g_return_if_fail like functions. Why not
>>> use g_assert here?
>>>
>>> In pure C, I used either assert for programming errors or returned an
>>> error indicator for expected errors. But where to use g_return_if_fail?
>>
>> g_assert aborts the process, g_return_if_fail() doesn't. It's a disastrous
>> idea to g_assert() in a library for example.
>>
>>
>>
>> behdad
>>
>>
>>> Thanks.
>
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]