Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
code_utils.h File Reference

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

Go to the source code of this file.

Macros

#define otEXPECT(aCondition)
 This checks for the specified condition, which is expected to commonly be true, and branches to the local label 'exit' if the condition is false. More...
 
#define otEXPECT_ACTION(aCondition, aAction)
 This checks for the specified condition, which is expected to commonly be true, and both executes anAction and branches to the local label 'exit' if the condition is false. More...
 
#define otEXIT_NOW(aAction)
 This unconditionally executes aAction and branches to the local label 'exit'. More...
 

Detailed Description

This file includes macros for validating runtime conditions.

Macro Definition Documentation

◆ otEXIT_NOW

#define otEXIT_NOW (   aAction)
Value:
do \
{ \
aAction; \
goto exit; \
} while (0)

This unconditionally executes aAction 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]aActionAn expression or block to execute.

◆ otEXPECT

#define otEXPECT (   aCondition)
Value:
do \
{ \
if (!(aCondition)) \
{ \
goto exit; \
} \
} while (0)

This checks for the specified condition, which is expected to commonly be true, and branches to the local label 'exit' if the condition is false.

Parameters
[in]aConditionA Boolean expression to be evaluated.

◆ otEXPECT_ACTION

#define otEXPECT_ACTION (   aCondition,
  aAction 
)
Value:
do \
{ \
if (!(aCondition)) \
{ \
aAction; \
goto exit; \
} \
} while (0)

This checks for the specified condition, which is expected to commonly be true, and both executes anAction and branches to the local label 'exit' if the condition is false.

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