Re: g_assert vs. g_return_if_fail



On 01/20/2010 04:38 PM, Jiří Zárevúcky wrote:
> Behdad Esfahbod píše v St 20. 01. 2010 v 13:18 -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
> 
> So there are two possibilities: g_assert when you want the application
> to abort, and g_return_if_fail when you don't. g_assert can be disabled
> compile-time for a release, right? In that case, it does nothing.
> 
> So why not add a compile option to make g_return_if_fail fatal, and
> simply deprecate g_assert? What is the point of having it there?

Can you please first state the problem you are trying to solve?

behdad


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]