[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] add more MISRA C rules to docs/misra/rules.rst



On Mon, 13 Jun 2022, Jan Beulich wrote:
> On 10.06.2022 23:27, Stefano Stabellini wrote:
> > +   * - `Rule 5.3 
> > <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_05_03.c>`_
> > +     - Required
> > +     - An identifier declared in an inner scope shall not hide an
> > +       identifier declared in an outer scope
> > +     - Using macros as macro parameters at invocation time is allowed
> > +       even if both macros use identically named local variables, e.g.
> > +       max_t(var0, min_t(var1, var2))
> 
> Nit: I would have been okay with the prior use of MIN() and MAX() in this
> example, but now that you have switched to min_t() / max_t() I think the
> example also wants to match our macros of these names. Hence I'd like to
> suggest that either you switch to using min() / max() (which also use
> local variables), or you add the missing "type" arguments in both macro
> invocations.

I see your point. I'll use min/max as follows:

max(var0, min(var1, var2))

If you are OK with that and there are no other suggestions this tiny
change could be done on commit.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.