Hello, since some days I'm browsing through the Gimp-Code. What I have seen so far looks very tidy. But I also found some things that I would do differently, throughout the whole code, and maybe also in the libs (I didn't looked at them in detail). I would do EVERY pointer set to NULL, when defining it. And normally I also would set ANY other value to a certain value, when defining it. This has helped me to track errors as early as possible. Example: ============================================== /*****************************************************************************/ /* public functions ********************************************************/ GimpContext * gimp_context_new (Gimp *gimp, const gchar *name, GimpContext *template) { GimpContext *context; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (! template || GIMP_IS_CONTEXT (template), NULL); context = g_object_new (GIMP_TYPE_CONTEXT, "name", name, "gimp", gimp, NULL); if (template) { context->defined_props = template->defined_props; gimp_context_copy_properties (template, context, GIMP_CONTEXT_ALL_PROPS_MASK); } return context; } ============================================== The test if( template ) makes only sense, if you can be sure that uninitialzed values will definitelky be NULL. If you are not sure that uninitialized values will be NULL, then the test if( template ) makes no sense. So: - either consequently setting all pointers to NULL, even you are intended to just right after this will set it to another value; if you forget this, then you at least has your NULL in the pointer. - or: you can completely avoid such tests as the above mentioned one, because you are sure that you alkready have initialized values. The former decision is the one that leads to easy maintainable code. The later decision is, what I would call going to become crap. It's a lot of work, looking for such stuff in all files. But I would say, it will definitely help in tracking down errors early. I can say this from many years of C programming. Any comments welcome. Ciao, Oliver _______________________________________________ Gimp-developer mailing list Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer