rspec/rules/S1270/rule.adoc
Fred Tingaud 22b4470f2a
Modify CFamily rules: CPP-4080 Refresh and standardize CppCoreGuidelines references (#3514)
Update all links to C++ Core Guidelines to `e49158a`.

Refresh done using the following script and some manual edits:
db76e34e74/personal/fred-tingaud/rspec/refresh-cppcoreguidelines.py

When re-using this script, be mindful that:
 - it does not cover `shared_content`
 - it does not properly escape inline code in links (e.g., "[=]" or "`mutex`es")
 - it does not change `C++` to `{cpp}` in link titles.

Co-authored-by: Marco Borgeaud <marco.borgeaud@sonarsource.com>
2023-12-20 10:08:18 +01:00

34 lines
760 B
Plaintext

== Why is this an issue?
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() {
...
}
----
== Resources
* {cpp} Core Guidelines - https://github.com/isocpp/CppCoreGuidelines/blob/e49158a/CppCoreGuidelines.md#nl25-dont-use-void-as-an-argument-type[NL.25: Don't use `void` as an argument type]