RE: Simple procedure question
- From: martyn 2 russell bt com
- To: gtk-app-devel-list gnome org
- Subject: RE: Simple procedure question
- Date: Mon, 17 Feb 2003 13:20:49 -0000
You should (as good coding practise) initialise ALL memory before using it,
pointers generally take NULL.
Regards,
Martyn
-----Original Message-----
From: Ivo Andrejco [mailto:andrejcoivo yahoo com au]
Sent: 18 February 2003 11:35
To: gtk-app-devel-list gnome org
Subject: RE: Simple procedure question
Hi,
I am not sure, but I think you have to initialize list to
NULL such as:
Here is an example:
#include <glib.h>
int main()
{
GList* list = NULL;
list = g_list_append( list,"Hello" );
list = g_list_append( list,"World" );
while( list != NULL )
{
gchar* data = (gchar*)list->data;
g_print("%s\n",data);
list = g_list_next(list);
}
}
if you try that without initializing to NULL you get segment fault.
If it's not what you where asking about then sorry.
Ivo
_______________________________________________
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]