Sujet : Re: Which code style do you prefer the most?
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.cDate : 26. Feb 2025, 09:41:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vpmk4d$2g34r$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
On 25/02/2025 23:02, Janis Papanagnou wrote:
On 25.02.2025 20:35, David Brown wrote:
[...]
Pick a tab size that suits /your/ preferences for coding, using tab
characters or spaces for whatever works best with /your/ choice of tools.
But only in your own projects. - Whenever you work in larger contexts
this shouldn't - any typically doesn't - apply any more.
Sure. But that has been covered already - for existing projects, it is usually best to stick to a consistent existing style. The same applies for code that is part of a project group, or written in a company with a standard style, or if there is something else requiring a specific style for the code (such as MISRA).
Even then, however, I would suggest challenging the status quo. That does not mean overriding the existing style choices, but it /does/ mean questioning them. Just because a project, company, or group has always used a particular style, does not mean there are good reasons for the choices - or that the original reasons are still relevant. Of course changing the style of existing code, or code added to an existing project, requires a lot stronger motivation than "I think it looks nicer" reasoning which is fine for picking your own style for your own code.
Style choices - like pretty much anything else in software development - should not be set in stone. Equally, it should not be changed lightly.