On Tue, 10 Jun 2008, Kai-Uwe Behrmann wrote:
>> work, but there is more overhead and the result is not pleasant.
>
> With more advancement the callback may become a answere to the many return
> code handling if's, which are not so nice eigther ;)
>
>  if(do_what_your_need()) {
>    send_error("error in do_what_your_need()");
>    exit();
>  }

The problem is that usually the error needs to handled in the invoking 
code rather than the callback.  So the callback deposits the 
information somewhere and when the errant function returns, the 
invoking code checks to see if there was an error, retrieves the 
information from the temporary holding location, and deals with the 
error.  If user context is passed via the callback, then the callback 
can cast that context into the presumed (not type safe) storage type 
of the object and insert the error info there for later use.

Usually only "Hello World" level code is going to handle the error by
calling exit().

If everyone used C++ then things would be all better. :-)

Bob
======================================
Bob Friesenhahn
[EMAIL PROTECTED], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to