Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 5.6 / Rule 5.7
#2
sparker Wrote:Is the intention that one deviates from R5.7 leaving R5.6 to catch the most important cases? If so that isn't very clear from the text.
.
I would agree that the example is a bit unfortune and it gets not very clear.

sparker Wrote:(Overall I'd be surprised if anyone ever sticks to R5.7 since it means that every identifier in your program, even every local, has to differ from every other. That means no "i", "j", "p", "speed", "rpm", ..., "index", etc.)

I assume they mean "identifer of (different) name spaces" (see R5.6).
As R5.6 carifies this has nothing to do with scope, so your program can contain i, j, p as loop variables (in various scopes) and still is compliant ;-)

Overall my point (i am NOT speaking for MISRA-C consortium) regarding identifiers is that they are not *so* very important. Most customers anyway have their own "naming-rules" and if you look at "coding-guidelines" in companies, they often deal with this issue (and unfortunately the largest part are often naming conventions, whereas the "real" stuff is missing. ;-)
Fortunately the real stuff is provided by MISRA-C, so I would perhaps deviate from R5.6 and R5.7 but use my own naming rule.

two other interessting points: (my observations)

1. often identifieres are confused because their names are different (so misra compliant) but they closely match (only some characters differ), e.g.
srv, svr, etc... Some lint-like-tools have add-ons that catch such candidates.

2. If you make a (very) rigorous naming schema you easily end up with either unreadable names or very long names (which could violate R5.1)


just my 3 cents,

kind regards,
Bernhard.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)