soloud icon indicating copy to clipboard operation
soloud copied to clipboard

getFilterParameter() return values and error codes can not be differentiated

Open petrihakkinen opened this issue 10 years ago • 1 comments

When getFilterParameter() is called with incorrect parameters it returns the error code INVALID_PARAMETER (1). It can not be distinguish from a normal return value, because it is perfectly valid for a filter parameter to be 1.

Either getFilterParameter() should have two return values (error code and the value), or return codes should be disabled for this function and a zero should be returned in the case of an error (zero is less surprising than 1). I would probably prefer the latter option, as two return values are messy in C/C++.

petrihakkinen avatar Nov 11 '15 19:11 petrihakkinen

Another option would be to make error codes negative as they are in several other systems.. but I'm tending towards returning 0 on error in this case.

jarikomppa avatar Nov 11 '15 19:11 jarikomppa