Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 8.10 and init functions
#3
MISRA C Rule 8.10 seeks to reduce the number of externally visible objects and functions – this is generally accepted as a good design principle. The rule states that any objects or functions that do not require external linkage should be given internal linkage using the static storage class specifier.

In your example, which is a good design, even though the init function is called only once, it requires external visibility because it is called from a function that is defined in another module. Therefore, Rule 8.10 does not apply.

As an example of when Rule 8.10 would apply, suppose you had a function defined in the main module. Suppose that this function should only ever be called by functions that are also defined in the main module. This function should be given internal linkage.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)