According to MISRA C++ 2-5-1
we should generally avoid messing up with digraphs. Though, I don't understand why we should also avoid the use of readable words and
, or
, not
etc. to define common operators &&
, ||
, ...
The issue is even highlighted as "major" issue for Sonar/MISRA:
[Major] Open Replace this digraph 'and' by its equivalent '&&'
[Major] Open Replace this digraph 'and' by its equivalent '&&'
[Major] Open Replace this digraph 'or' by its equivalent '||'
[Major] Open Replace this digraph 'or' by its equivalent '||'
[Major] Open Replace this digraph 'or' by its equivalent '||'
Is the rule also including the human readable digraphs (that are quite different from the cryptic ??=
, ??/
) for a particular reason or the rule is just too generic?
I haven't found any particular risk or side effect at using them, am I wrong?
Summing up
is there a functional reason for this MISRA rule to include also the human readable digraphs? Should I avoid them only to satisfy blindly a code compliance rule or there's some real tricky reason hiding behind?