Re: g_assert vs. g_return_if_fail



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?

Attachment: signature.asc
Description: Toto je =?UTF-8?Q?digit=C3=A1ln=C4=9B?= =?ISO-8859-1?Q?_podepsan=E1?= =?UTF-8?Q?_=C4=8D=C3=A1st?= =?ISO-8859-1?Q?_zpr=E1vy?=



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