Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

`DCL51-CPP`: Only reserve function names when used within the global namespace

Offen
#148 5 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@lcartey arbeitet bereits daran.

Seit 14.1.2024.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

Difficulty-High false positive/false negative Impact-High Stardard-CERT-C++ user-report
Affected rules
  • DCL51-CPP
Description

The rule currently enforces that function names defined in standard library headers are not reused in any namespace. However, a careful re-reading of the C++ standard suggests that's overly specific. [reserved.names] specifically states that the only kinds of name that are reserved are macros, "global names" and "names with external linkage". In [extern.names], the standard says:

Each global function signature declared with external linkage in a header is reserved to the implementation to designate that function signature with external linkage.

So only global function signatures are reserved, and only where they have external linkage. I think we need to do the following:

  • Apply only to the global namespace
  • Filter list of reserved function names by those that appear in the global namespace and have external linkage (this may already be the case).
  • Match function signatures (I believe it is valid to reuse the name as long as the signature is different).

We may also need to review the rules for objects and _ prefixes.

Example
namespace MyNamespace {
  void all_of(); // COMPLIANT
}
Vorherrschende Sprache
CodeQL
Sterne
227
Forks
82
Ø Merge
6 T. 7 Std.
Gemergte PRs (30 T.)
9

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus github/codeql-coding-standards

Alle Issues in github/codeql-coding-standards

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.