On 04/03/24 09:04, Jan Beulich wrote:
On 01.03.2024 16:04, Federico Serafini wrote:
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -322,6 +322,12 @@ Deviations related to MISRA C:2012 Rules:
- /\* Fallthrough \*/
- /\* Fallthrough. \*/
+ * - R16.6
+ - A switch statement with a single switch clause and no default label is
+ deliberate and improves readability with respect to an equivalent if
+ statement.
+ - Tagged as `deliberate` for ECLAIR.
Imo this is another example of wording a deviation in too wide a manner.
It shouldn't be "is", but "may". Whether what is said here applies is
entirely down to every specific instance; otherwise I'm inclined to read
this as a suggestion to replace all if() by switch(), for that always
improving readability. FTAOD things would be different if this was
explanatory text to a SAF comment - there the specific context is always
given (by where the comment actually appears).
Ok, I'll rephrase a v2.
--
Federico Serafini, M.Sc.
Software Engineer, BUGSENG (http://bugseng.com)