Le 25/07/2014 23:46, Ameen Sayegh a écrit : > [...] and I'm interested in C Language and its simplicity
I'm afraid that's not completely true :) > [...] > > I have some question about the source code that I don't know what it > does mean for example: > gmem.h:120: "(void) (0 ? (gpointer) *(pp) : 0);" That's a hack to catch misuses of the g_clear_pointer() macro. See https://bugzilla.gnome.org/show_bug.cgi?id=674634#c34 The idea is that if pp is a pointer and not a pointer to pointer, each branch of the conditional expression will have a different type and this is invalid -- hence the compiler will error-out. To take Xavier's example, imagine the following code: struct { gpointer x; } test; g_clear_pointer(&test); The first static assertion in g_clear_pointer() (which is (sizeof *(pp) == sizeof (gpointer))) won't catch it as the struct has the size of a gpointer, so it would go unnoticed. Therefore, there is this second hack to make sure to catch this. Regards, Colomban _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-devel-list