Re: g_assert vs. g_return_if_fail

Martin Kalbfuß píše v Čt 21. 01. 2010 v 01:14 +0100:
> OK, Many thanks. That's a good reason not to use g_assert, in such a
> place.
> But when the caller should have the ability to handle the error, why not
> use GError? Isn't it exactly doing this? Indicate an error, but don't
> abort the program on it's own?
> Wrong input from a user is not a programming error.

You have to validate the data yourself. When the function itself doesn't
do any IO, why should it return GError? Not checking the input values
before further use is in fact a programming error.

> >  Also if your library is re-compiled with the option to remove assert
> > then it won't have any checking any more 

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]