From: Lutz <lu...@us...> - 2004-05-18 05:19:59
|
On Mon, 2004-05-17 at 22:39, Joerg Hoh wrote: > Nope. I don't talk about any kind of interaction with the user on > application side. I talk about how errors in functions can be detected from > a calling one. What does the calling function do with the information 'error occurred'? > Why do I have to return a struct when no error occurred? I thought about something like that: int main (...) { int i1, i2; ExifError e = {0, ""}; /* Calling a function without error checking */ exif_function (i1, i2, NULL); /* Calling a function with error checking */ exif_function (i1, i2, &e); if (e.id != 0) printf ("Error %i occurred: %s.\n", e.id, e.msg); } > On high-level > functions (which will be be called from application side) we can think > about such a solution, but not on low-level. As long as the low-level part of the library returns enough information to enable the user (or the one to whom the user complains) to understand the problem, I agree with you. Note that at the end of the chain of calling functions, there is always a user. Lutz |