rspec/rules/S1270/rule.adoc
2022-02-04 16:28:24 +00:00

32 lines
691 B
Plaintext

Explicitly specifying a ``++void++`` parameter list is required in C, but optional in {cpp}. Using ``++void++`` for a parameter-less function decreases its readability. The at-a-glance impression is that the function _does_ take a parameter, and it takes a second look to ascertain that it does not. Therefore the more compact notation is preferred.
== Noncompliant Code Example
[source,text]
----
int fun(void);
int fun(void) {
...
}
----
== Compliant Solution
[source,text]
----
int fun();
int fun() {
...
}
----
== See
* https://github.com/isocpp/CppCoreGuidelines/blob/036324/CppCoreGuidelines.md#Rl-void[{cpp} Core Guidelines NL.25] - Don't use void as an argument type