Software Archive
Read-only legacy content
17061 Discussions

PXC_STATUS_NO_ERROR insonsistency

Zsolt_E_
New Contributor I
540 Views

Can someone explain to me what is the rationale behind half the functions requiring >= PXC_STATUS_NO_ERROR while the other half < PXC_STATUS_NO_ERROR for the valid operation?

 

 

0 Kudos
3 Replies
Jonathan_M_Intel
Employee
540 Views

The pxcStatus is used to return some warning information along with failure information.  In some cases, the function will return appropriately, but the SDK wants to warn the user/developer that something inappropriate, but not code-breaking has happened.  Check the value definitions in pxcstatus.h for a listing of all the codes.

Basically, if your function returns a negative value (pxcStatus < PXC_STATUS_NO_ERROR) means that the code should not continue, and you as a developer should include some error handling that defines how you want the app to degrade, or restart, or close.  There shouldn't be any cases where a negative status value means the app is behaving correctly, can you point out anything you've found where that's the case?

 

 

0 Kudos
Zsolt_E_
New Contributor I
540 Views

Hi Jonatan,

Thanks for the explanation, I've double checked all occurrences in the samples and you are right indeed. < is always used for error and >= is used for ok.

I'm still a bit puzzled about when should I use == and when should I use >=, both are used in the samples (as well as != actually). Do you have a recommendation on == vs >=?

0 Kudos
Jonathan_M_Intel
Employee
540 Views

The documentation should tell you whether or not a given function will ever return one of the warning messages.  In those cases you need to be sure to use >=, but otherwise in most cases == will be best.  Here is an example of one of the audio processing functions that warns about a too-large time gap between audio samples.  The rest are likely reserved for future implementation.   

 

0 Kudos
Reply