5.8 Error Handling and ASSERT

ASSERT macros are development and debugging aids and shall never be used for error handling.

Assertions are used to catch conditions caused by programming errors that are resolved prior to product release.

The EDK II PCD, PcdDebugPropertyMask, can be used to enable or disable the generation of code associated with ASSERT usage. Thus, all code must be able to operate, and recover in a reasonable manner with ASSERTs disabled.

Parameters and conditions that are beyond the programmers control need to be checked programmatically. Care must be taken, though, to ensure that the need for programmatic error handling is minimized.

The ASSERT_EFI_ERROR, ASSERT_PROTOCOL_ALREADY_INSTALLED, and all other ASSERT macros defined in DebugLib.h are covered by this rule.