From: Joerg H. <jo...@de...> - 2004-05-17 20:39:06
|
On Mon, May 17, 2004 at 08:18:56PM +0200, Lutz Müller wrote: > On Sun, 2004-05-16 at 16:17, Joerg Hoh wrote: > > I prefer a to replace at least some void-functions with (signed) int with a > > standard return value of 1; if an error happens, they will return something > > != 1 (normally < 1). > > (1) User clicks and empty information shows up. > This is the case now. > > (2) User clicks and gets message: "An error occurred." > This is your proposal. 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. > (3) User clicks and gets message: "Error xy occurred." > Like EXIF_ERROR_CORRUPT_DATA, > EXIF_ERROR_UNKNOWN_FORMAT > > (4) User clicks and gets message: > "Error xy occurred at byte 4711 in EXIF data. > The EXIF data in your image is broken. > Please contact mailing list xyz." > Implemented i.e. like > void exif_data_load_data (..., ExifResult *result); > where > typedef struct { > char *msg; > ExifError err; > } ExifResult; I don't want to bloat the library. And yes, such a solution would be bloat. Why do I have to return a struct when no error occurred? How do I allocate a structure when a malloc(10) failed? Then we should have an error handling for the error handling... Returning a simple int in some functions is just enough. On high-level functions (which will be be called from application side) we can think about such a solution, but not on low-level. Joerg -- Fachbegriffe der Informatik (Nr 275): Luster-Format - Positiv gemeint: Eßfreudig Negativ gemeint: Das Äquivalent von zwei Öltanks Alexander Stielau |