Was There an Error or Not?

David Thomson, Original Code Consulting, July, 2019

One project I was working on selected a high-end high speed digitizer from a large, well respected high tech company. The API for the digitizer was already wrapped up in LabVIEW VIs by the company, and the overall design of the API was not bad. But for some reason, the original developer had chosen to define the standard C function return value exactly opposite of normal practice: a value of 0 indicated an error, while a value of 1 indicated success! Another peculiarity with this device became apparent when you needed to connect more than one to a single computer. There was no way to pre-select which one to acquire a reference to. Instead, they provided a function that listed all the digitizers connected to the computer. Then you could query each one for its serial number. When you found a match, the position of that match within the array of digitizers became the "address" for the one you wanted to use. And by the way, the order in which the digitizers would appear in the array of all digitizers is not guaranteed to be the same each time you ask, so you have to match serial numbers every time your program starts.

David Thomson