0.01.00
code_utils.hpp File Reference

This file includes macros for validating runtime conditions. More...

Go to the source code of this file.

Macros

#define otALIGNED_VAR_SIZE(size, align_type)   (((size) + (sizeof (align_type) - 1)) / sizeof (align_type))
 
#define otDEFINE_ALIGNED_VAR(name, size, align_type)   align_type name[(((size) + (sizeof (align_type) - 1)) / sizeof (align_type))]
 
#define SuccessOrExit(aStatus)
 This checks for the specified status, which is expected to commonly be successful, and branches to the local label 'exit' if the status is unsuccessful. More...
 
#define VerifyOrExit(aCondition, ...)
 This checks for the specified condition, which is expected to commonly be true, and both executes ... More...
 
#define ExitNow(...)
 This unconditionally executes ... More...
 
#define IgnoreReturnValue(aStatement)
 

Detailed Description

This file includes macros for validating runtime conditions.

Macro Definition Documentation

§ ExitNow

#define ExitNow (   ...)
Value:
do \
{ \
__VA_ARGS__; \
goto exit; \
} while (false)

This unconditionally executes ...

and branches to the local label 'exit'.

Note
The use of this interface implies neither success nor failure for the overall exit status of the enclosing function body.
Parameters
[in]...An optional expression or block to execute when the assertion fails.

§ IgnoreReturnValue

#define IgnoreReturnValue (   aStatement)
Value:
do \
{ \
if (aStatement) {} \
} while (false)

§ SuccessOrExit

#define SuccessOrExit (   aStatus)
Value:
do \
{ \
if ((aStatus) != 0) \
{ \
goto exit; \
} \
} while (false)

This checks for the specified status, which is expected to commonly be successful, and branches to the local label 'exit' if the status is unsuccessful.

Parameters
[in]aStatusA scalar status to be evaluated against zero (0).

§ VerifyOrExit

#define VerifyOrExit (   aCondition,
  ... 
)
Value:
do \
{ \
if (!(aCondition)) \
{ \
__VA_ARGS__; \
goto exit; \
} \
} while (false)

This checks for the specified condition, which is expected to commonly be true, and both executes ...

and branches to the local label 'exit' if the condition is false.

Parameters
[in]aConditionA Boolean expression to be evaluated.
[in]...An expression or block to execute when the assertion fails.