llvm/llvm-project

modernize-use-digit-separator

Open

#35.414 geöffnet am 23. Jan. 2018

Auf GitHub ansehen
 (15 Kommentare) (0 Reaktionen) (1 zugewiesene Person)C++ (10.782 Forks)batch import
bugzillacheck-requestclang-tidygood first issue

Repository-Metriken

Stars
 (26.378 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 1T 2h) (1.000 gemergte PRs in 30 T)

Beschreibung

Bugzilla Link 36066
Version unspecified
OS All

Extended Description

Create a check that looks for long integral constants and inserts the digits separator (') appropriately.

Suggested groupings:

  • decimal integral constants, groups of 3 digits, e.g. int x = 1'000;
  • binary integral constants, groups of 4 digits, e.g. int x = 0b0010'0011;
  • octal integral constants, groups of 3 digits, e.g. int x = 0377'777;
  • hexadecimal integral constants, groups of 4 digits, e.g. unsigned long x = 0xffff'0000;
  • floating-point constnats, group into 3 digits on either side of the decimal point, e.g. float x = 3'456.001'25f;

This check requires C++14.

Provision could be made for supplying a mapping of numeric literal type to number of digits to be grouped.

Contributor Guide