> > On Tue, Sep 12, 2017 at 07:19:32AM -0400, Frediano Ziglio wrote: > > About checking for pointer assuming you have to check for NULL > > would mean the NULL is not 0 which would mean that > > memset(structure_ptr, 0, sizeof(structure)) cannot set pointer > > to NULL which would mean that assuming pointer initialized from > > GObject NULL are not correct, I would personally vote again > > the if (pointer != NULL) style, if (pointer) is good as well. > > I'm not saying it's more correct, I'm saying it can make the code easier > to read. > > if (obscure_name) {} -> you know from reading the code it's a boolean > if (obscure_name != 0) {} -> ok, it's some int value > if (obscure_name == NULL) {} -> this time it's a pointer > > Christophe > C has no strong boolean, gboolean for instance is an int but I won't check as if (gboolean_var != 0). You just should not use obscure_name on the first place, or we should use the hungarian notation (joking) ! Said that "if (pointer)" is perfectly fine. All personal opinions obviously, there are great code either using one syntax or the other. Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel