MISRA Compliant
Note |
|---|
For the MISRA compliant strategy, the native int size of the compiler must be 16 bit or 32 bit. |
With this casting strategy, ASCET supports type casting that is compliant to MISRA-C:2012 rules 7.2, 10.3, 10.4, 10.6, 10.7, and 10.8.
Casting for binary arithmetic expressions is done as follows:
Determine the
union interval as the union of the result interval with the intervals of all operands.Determine the result type according to the MISRA integer conversion rules.
If the union interval cannot be represented in the result type, do a MISRA cast of both operands to the smallest type that can represent the union interval.
The result type is signed if both operands are signed.
A MISRA cast is a regular C cast on the expression if an explicit cast is allowed. If an explicit cast is not allowed, the expression is assigned to a temporary variable and then the temporary variable is casted with a regular C cast.
See also