Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
Cast Module - Architecture
  • Range-checked type conversions. Validates value fits destination type before
  • converting. Returns SAPI_STATUS_VALUE_OUT_OF_RANGE if out of bounds.

Conversion Functions

  • sapi_cast_i8_to_i16() - From int8_t to int16_t (and variants)
  • Return: OK if fits, VALUE_OUT_OF_RANGE otherwise

Check-Before-Convert

  • 1. Check if value in destination range
  • 2. If yes: convert and return OK
  • 3. If no: don't modify output, return error

MISRA Rule 10.1

  • ✓ No implicit conversions
  • ✓ Explicit checked casts only
  • */