Video: Avoid Unary Minus on Unsigned Integers - MAB Guideline jc_0451

Avoid Unary Minus on Unsigned Integers: MAB Guideline jc_0451

The MAB guideline jc_0451 states that the unary minus operator shall not be used on unsigned integers in Stateflow environments. The main reason is that this operation does not produce the expected negative number. Instead, it results in a large positive number, as unsigned integers cannot represent negative values.

Additionally, the result of the operation may vary depending on the environment, potentially leading to unintended behavior and hard-to-find bugs. Therefore, the best practice is to avoid this entirely. Nevertheless, since finding such bugs is very time-consuming, the MES Model Examiner (MXAM) also flags violations of this guideline, helping you achieve compliance.

Curious how MXAM supports compliance with safety standards?

Get in Touch with Us

This image shows Elena Bley.
Elena Bley
Senior Manager Webinars & Training

* Mandatory field

Please calculate 8 plus 6.