Re: return value checking for GTK APIs
- From: Tristan Van Berkom <vantr touchtunes com>
- To: brahmaiah vallabhaneni <vbrahmaiah yahoo com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: return value checking for GTK APIs
- Date: Wed, 25 Sep 2002 10:33:26 -0400
Yeah, that pretty much shoked me too.
Personally I still check my return values
but I think that the memory allocations call "abort()"
when they dont succeed. (I didn't see the code myself
but I heard it through the grapevine).
Anyway this doesn't mean that functions
are garaunteed to never return NULL. for instance;
if you call a function that creates a new object
and pass it some invalid arguments it should return
NULL. you'll notince in the code most functions
inside objects will start with the following macros:
g_return_if_fail((arg != NULL));
_or_
g_return_val_if_fail((arg != NULL), NULL);
which by the way will cause a program to exit()
_IF_ your application is compiled in DEBUG.
Hope I saved you some troubble,
-Tristan
brahmaiah vallabhaneni wrote:
Hi All,
I am new to Linux GUI programming and started going
through the tutorial.
But I have observed one strange coding style (to me).
Usually, when we call a function say malloc, we
always validate the return value before it's use.
But in GTK samples, they do n't check the return
value of APIs. Any specific reason ?
Is it always guranteed that these APIs succeed ?
Pls tell me if I am missing some thing....
Thanks and Regards,
V.Brahmaiah
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]