cpp-best-practices / cpp-best-practices/cppbestpractices
Never Mix Tabs and Spaces - revisited
- Linguagem predominante
- Sem dados de linguagem
- Estrelas
- 8.8k
- Forks
- 902
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Nenhum arquivo, teste ou ponto de entrada é indicado. Comece localizando as orientações existentes do repositório sobre estilo de código e determine se esta discussão tem um resultado acordado; para considerar o trabalho concluído, seria necessário ter uma política definida sobre tabulações e espaços, documentada nas orientações apropriadas.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- cpp
- Domínio
- documentation
- Tipo de issue
- Documentação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100