cpp-best-practices / cpp-best-practices/cppbestpractices
Never Mix Tabs and Spaces - revisited
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 8.8k
- Forks
- 902
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I was always in the - use only spaces - group for coding.
Until recently, when I started using clang-format. It has many options:
> UseTab (UseTabStyle)
> The way to use tab characters in the resulting file.
> Possible values:
> UT_Never (in configuration: Never) Never use tab.
> UT_ForIndentation (in configuration: ForIndentation) Use tabs only for indentation.
> UT_ForContinuationAndIndentation (in configuration: ForContinuationAndIndentation) Use tabs only for line continuation and indentation.
> UT_Always (in configuration: Always) Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one.
Now I use the setting: ForIndentation
Which uses Tabs for indenting the the block, and if more indentation is required for aligning, then spaces are used.
So it doesn't matter wether someone has 2, 4, or 8 spaces per tab, the code is always aligned correctly.
Currently my stance is: use Tab for indenting, use space for aligning.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Es wird keine Datei, kein Test und kein Einstiegspunkt genannt. Beginne damit, die bestehenden Richtlinien des Repositorys zum Coding-Stil zu finden, und stelle fest, ob diese Diskussion zu einem vereinbarten Ergebnis geführt hat; für den Abschluss wäre eine festgelegte Tabulator-und-Leerzeichen-Regel erforderlich, die in den entsprechenden Richtlinien dokumentiert ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100