rspec/rules/S3541/cfamily/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

65 lines
1.2 KiB
Plaintext

== Why is this an issue?
Allocation functions are always ``++static++``. Explicitly declaring such a function ``++static++`` needlessly clutters the code.
=== Noncompliant code example
[source,cpp]
----
struct S {
static void* operator new(std::size_t); // Noncompliant; static is redundant
static void operator delete(void*); // Noncompliant; static is redundant
};
----
=== Compliant solution
[source,cpp]
----
struct S {
void* operator new(std::size_t);
void operator delete(void*);
};
----
== Resources
* Reference: Since {cpp}98 (ISO IEC 14882 1998) 12.5 §1 and §6
____
Any allocation function for a class T is a static member (even if not explicitly declared static).
____
____
Any deallocation function for a class X is a static member (even if not explicitly declared static).
____
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this redundant static specifier.
=== Highlighting
"static" specifier
'''
== Comments And Links
(visible only on this page)
=== on 2 Mar 2016, 11:30:20 Alban Auzeill wrote:
\[~ann.campbell.2] Could you set yourself as Reporter ?
endif::env-github,rspecator-view[]