On 25.8.2014 16:06, Jacek Bukarewicz wrote:
In my opinion mixing them is acceptable as long as they can be easily differentiated. For example, negative values for errors, non-negative for responses. Unfortunately, that's currently not the case where "access granted" response is 0, "access denied" is -1 and error codes are also negative.
I would like to use simple switch-case construct to deal with response and "default" bailing out with fatal error. Of course it is also possible in this case, but the value space is not as nicely restricted as it would be with enums.
Error code would be accessed only when enum indicate failure. A bit like errno in POSIX API. Or non-NULL GError with GLib.
For errors I would prefer a GError-style construct where error would be a struct with both error code and a human-readable message.
_______________________________________________ Dev mailing list [email protected] https://lists.tizen.org/listinfo/dev
