Sujet : Re: Buffer contents well-defined after fgets() reaches EOF ?
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 11. Feb 2025, 01:59:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250210165312.447@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-02-10, Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> wrote:
On 10.02.2025 07:41, Keith Thompson wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 10.02.2025 05:37, Keith Thompson wrote:
[...]
This is already off-topic, so I won't even mention tabs vs. spaces.
>
But as Vim users we don't have any issues here; as long as the
indentation is _visibly_ consistent we can fix any tab/space-mix
on the fly and easily with Vim.
Yes, *if* the indentation is visibly consistent.
At a previous job, I reviewed an update whose apparent meaning
differed depending on whether the editor was configured with 4- or
8-column tabstops. I don't remember the exact details, but the code
looked like either:
if (condition)
statement1;
statement2;
or:
if (condition)
statement1;
statement2;
depending on the reader's settings. Of course they're semantically
equivalent, but the first is the way the developer saw it, and the
second is misleading and is the way it looked to me.
>
Yeah, misleading code is a pain, especially if you have got the job
to fix some error in these incoherent formatted modules.
Turning on gcc -Wmisleading-indentation could go a long way toward
hunting down the trouble spots.
Not sure how that well that deals with inconsistent mixtures of tabs and
spaces. The man page documentation (I realize there is also the real
GCC manual) says that the amount of indentation is determined by
the -ftabstop=N option, where N defaults to 8.
So I'm guessing that you may have to compile the code at least
two ways---with -ftabstop=4 -ftabstop=8 and possibly other
choices---to get the all bad spots to look like your second example and
be diagnosed.
They should support a nondeterministic behavior:
-fabstop=2,4,8
fork reality into all those tabstops and diagnose in all of them
in the same pass.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca