On Thursday 18 November 2004 20:30, Neil Zanella wrote: > I was just wondering whether > > g_list_next(foo) > > and > > foo->next > > are really the same or not. It seems to me that they are but > that the former construct is preferable for object-oriented-like reasons. ~/src/cvs/glib/glib ---> grep g_list_next glist.h #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) So yes, they are basically the same, with the exception that you can use g_list_next() on a NULL pointer, while you can't do that with l->next, so if you have already checked for NULL anyway, like in for (l = list; l; l = l->next) { ... do stuff ... } you save the extra check that g_list_next() would introduce. Which of the two you use is mostly a matter of personal preference; this is really basic API that's very unlikely to change anytime soon. It's definitively nothing to worry about, and if you check the Gtk+ source code (for example), you'll see that both varieties are used. Cheers -Tim _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list