I've been working on interacting with an instrument via the manufacturer's DLL based API. Most calls return a status code like (0 Success, 1 Disconnected, 2 Error, etc, etc). This has proven to be problematic in some instances. For instance, if the API call simply doesn't actually work, the default value is returned, 0 Success, which is surely not good.
This has me thinking, what would be the proper way for designing an API status code system? My first thought is that the default value should probably always be the error code, that way it's safe whether or not the call succeeds. But I can't recall working with an API where that was the case, 0=error. Usually it seems -1 is, at least in the LabVIEW world. What do you think?
Maybe negate error code + 8000 to get you to a standard custom user error? (As an aside, -8000 to -8999 range is new to me for LabVIEW custom error range - I always thought the negative range was -5000 to -5999. Did I remember incorrectly?)