On Thu, Jun 30, 2011 at 01:12, Jie Zhang wrote: > On Thu, Jun 30, 2011 at 1:08 AM, Mike Frysinger wrote: >> On Thu, Jun 30, 2011 at 01:00, Jie Zhang wrote: >>> On Thu, Jun 30, 2011 at 12:57 AM, Mike Frysinger wrote: >>>> On Thursday, June 30, 2011 00:52:49 Jie Zhang wrote: >>>>> If it's true that user should always call urj_error_describe on >>>>> URJ_LOG_LEVEL_ERROR or URJ_LOG_LEVEL_WARNING, why adding an assert is >>>>> a bad idea? >>>> >>>> it's a library. libraries are supposed to return errors, not crash. >>> >>> But if user should always call urj_error_describe on >>> URJ_LOG_LEVEL_ERROR or URJ_LOG_LEVEL_WARNING, the assert will never >>> fail, so never crash. >> >> and if they call it with some other value, they should get back an >> error code, not abort the whole application > > That's why I think using a new type instead of urj_log_level_t will be > better. It will accurately tell the library user what kind of values > are allowed.
that doesnt prevent users from passing -12315 if we were talking about an internal convenience library that only the urjtag binary called, then that'd be one thing. but since liburjtag.so is an exported library, we have to have proper library behavior. like not using assert() to validate arguments from the user. especially when we also start talking about things like bindings into other languages ... python should cause a traceback on invalid args (and that'd be handled in the bindings layer), but that isnt possible if the library is crashing the app at the lowest level. -mike ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ UrJTAG-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/urjtag-development
