Jacob Kroon wrote: > Let's say the container class had a method which would perform an > operation on all of it's children, and that this operation could fail. > If an error occures somewhere down in the hierarchy I wan't the caller > to be notified, a message, and if it was a child who caused the error, > report it too.
I would define a struct error, with a pointer (or name) of the object that's raising the error condition, appropriate strings to hold messages about the error, and an array of pointers to the struct errors of the (direct) children that raised the error. Which could have raised the error themselves OR contain pointers to their children's struct errors. All the methods return a pointer to their own struct error, or NULL if no error occurred neither in their call nor in their children's. The top-level invocation could instead do the parsing of the struct error tree and return something else more legible by the library's users. Um, actually I would use Lisp instead of C, but I guess that's not the answer you're looking for :-) Toby -- Signed/encrypted mail welcome. GPG/PGP Key-Id: 0x15C5C2EA _______________________________________________ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list