NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
Error Handling

Detailed Description

nverror.h contains our error code enumeration and helper macros.

Macros

#define NV_CHECK_ERROR(expr)
 A helper macro to check a function's error return code and propagate any errors upward. More...
 
#define NV_CHECK_ERROR_CLEANUP(expr)
 A helper macro to check a function's error return code and, if an error occurs, jump to a label where cleanup can take place. More...
 

Macro Definition Documentation

◆ NV_CHECK_ERROR

#define NV_CHECK_ERROR (   expr)
Value:
do \
{ \
e = (expr); \
if (e != NvSuccess) \
return e; \
} while (0)

A helper macro to check a function's error return code and propagate any errors upward.

This assumes that no cleanup is necessary in the event of failure. This macro does not locally define its own NvError variable out of fear that this might burn too much stack space, particularly in debug builds or with mediocre optimizing compilers. The user of this macro is therefore expected to provide their own local variable "NvError e;".

Definition at line 56 of file nverror.h.

◆ NV_CHECK_ERROR_CLEANUP

#define NV_CHECK_ERROR_CLEANUP (   expr)
Value:
do \
{ \
e = (expr); \
if (e != NvSuccess) \
goto fail; \
} while (0)

A helper macro to check a function's error return code and, if an error occurs, jump to a label where cleanup can take place.

Like NV_CHECK_ERROR, this macro does not locally define its own NvError variable. (Even if we wanted it to, this one can't, because the code at the "fail" label probably needs to do a "return e;" to propagate the error upwards.)

Definition at line 71 of file nverror.h.

NvSuccess
@ NvSuccess
Definition: nverror.h:42