cpp-best-practices / cpp-best-practices/cppbestpractices
Never Mix Tabs and Spaces - revisited
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 8.8k
- Fork
- 902
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Non viene indicato alcun file, test o punto di ingresso. Inizia individuando le linee guida esistenti del repository sullo stile del codice e determina se questa discussione ha raggiunto un esito concordato; per considerare il lavoro completato sarebbe necessaria una policy definita su tabulazioni e spazi, documentata nelle linee guida appropriate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100