Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

lib_def.h

Prototype

Code Block
LanguageC++
CaptionTextCAPTION
languagecpp
          DEF_CHK_VAL(val, val_min, val_max);


Arguments

val

Value to validate.

...

DEF_CHK_VAL() does not validate that the maximum value (val_max) is greater than or equal to the minimum value (val_min).

Example Usage

C++
Code Block
Language
CaptionTextCAPTION
languagecpp
          #define  CFG_VAL           -1
           
          #if     (DEF_CHK_VAL_MAX(CFG_VAL, 0u, 1000u) != DEF_OK)  /* Signed CFG_VAL NOT promoted to unsigned. */
          #error  "CFG_VAL must be >= 0 and <= 100"
          #endif