Liste des Groupes | Revenir à cl c |
On 23/09/2024 07:16, David Brown wrote:What I would be looking for in this case is a warning if I had used tabs and spaces (for indents) at different places in the code. If the tab setting is a sensible choice - typically 4 or 8 spaces worth - then you can easily have code that looks right (in the sense of having visual indents that match the real block structure) with one setting and looks wrong with a different setting.On 22/09/2024 22:39, Keith Thompson wrote:Isn't that the opposite of what you want, though?Bart <bc@freeuk.com> writes:>On 22/09/2024 16:11, Kaz Kylheku wrote:[...]>Also GCC has been able to diagnose misleading indentation for some>
years now.
How many years was that out of the last 52? How exactly do you turn it
on? Since -Wall -Wpedantic -Wextra doesn't report it.
The -Wmisleading-indentation option was added to gcc on 2015-05-12,
and incorporated into -Wall 2015-12-10. gcc 6.1.0 has the option
and includes it in -Wall; gcc 5.3.0 does not. (Are you using a gcc
release that old?) It uses the -ftabstop= option (defaulting to 8)
to determine whether indentation lines up or not.
>
Inconsistent tabstops and mixing of spaces and tabs can certainly
cause problems.
>
That would be detected quite easily if the default for -ftabstop were, say, 27. Then the chance of accidentally matching indents with tabs and spaces would be negligible.
>
Les messages affichés proviennent d'usenet.