Re: let g_warn_if_fail replace g_assert

Marco Barisione wrote:
Il giorno mer, 17/10/2007 alle 11.56 +0200, Tim Janik ha scritto:
- add g_warn_if_fail (condition); which produces a critical
   warning about failing assertions but contrary to g_assert

If it's called g_warn_if_fail() I would expect a g_warning() not a

Agreed -- and of course g_return_if_fail() does a g_warning(), so doing a g_warning() on g_warn_if_fail() is kinda redundant. How about g_critical_if_fail()?

It's a shame tho that we can't encode the "it returns if it fails" behavior in the name as well -- g_return_if_fail() is very clear what it does (IMO, the fact that it also does a g_warning() is a debugging-related bonus, not its primary purpose). g_critical_if_fail() sorta sounds like all it does is do a g_critical() if the condition fails, and then continues on from that point. I suppose g_critical_return_if_fail() is a bit verbose (esp. when you consider g_critical_return_val_if_fail() is even longer). But I guess good API docs will suffice ^_^.


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