50 lines
913 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
Naming the parameters in a function prototype helps identify how they'll be used by the function, thereby acting as a thin layer of documentation for the function.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2021-04-28 16:49:39 +02:00
----
void divide (int, int);
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,cpp]
2021-04-28 16:49:39 +02:00
----
void divide (int numerator, int denominator);
----
== Resources
2021-04-28 16:49:39 +02:00
* MISRA C:2004, 16.3 - Identifiers shall be given for all of the parameters in a function prototype declaration
* MISRA C:2012, 8.2 - Function types shall be in prototype form with named parameters
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Give names to the parameters of this function prototype.
'''
== Comments And Links
(visible only on this page)
=== relates to: S819
=== relates to: S927
=== is related to: S829
endif::env-github,rspecator-view[]