Skip to content
Commit d03fa8d8 authored by Abramo Bagnara's avatar Abramo Bagnara Committed by Anas Nashif
Browse files

coding guidelines: partially comply with MISRA C:2012 essential types rules.



In particular:

- use bool when the data nature is Boolean;

- use explicit comparison with 0 or NULL;

- avoid mixing signed and unsigned integers in computations and
  comparisons;

- avoid mixing enumerations with integers: when this is unavoidable,
  always convert enums to integers and not the other way around;

- avoid mixing characters with integers;

- ensure computations are done in the destination precision;

- added /*? comments when the developer intentions are not clear;

- added U suffix to unsigned constants (except for the CONFIG_* macro
  constants, as they cannot be changed and then their use as unsigned
  constants should be prefixed with a cast).

Violations for rules 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8,
11.7, 12.2, 14.4 and 16.7 in the reference builds have been reduced
from 67818 to 60.  The commit cannot be divided on a per-rule basis
due to numerous cross-dependencies between changes.

Signed-off-by: default avatarAbramo Bagnara <abramo.bagnara@bugseng.com>
parent 40cf447b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment