nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Nmh-commits Digest, Vol 108, Issue 11

2018-01-22 17:59:18
Hi Paul and Bakul,

Paul wrote:
Ralph Corderoy (7):
    fmttest.c: Avoid `++' with bools, silencing compiler warnings.

i hate that perfectly reasonable, traditional idioms have to be
avoided for this reason.

No strong reason to use type bool in the first place. It didn’t show
up till c99.

You're both wrong.  :-)

It's always been confusing that MH uses `foo++' to process `-foo'
because it's not clear from that location whether multiple `-foo' are
significant, e.g. they might increase the fooness.  By changing foo's
definition to a bool it's is very clear that only its truthness matters.
Those left as non-bool, once the move to bool is completed, suggest that
the non-zero quantity matters.

Further, elsewhere there are quite a few eight-bit ints that are happily
`++'d without care that this incrementing might happen to stop at the
point it has wrapped to zero.  IIRC mhparam used to try and exit(3) with
the number of missing components.  I readily use `++' instead of `+= 1',
who wouldn't?  But not without considering overflow in both cases.

As for C99, POSIX mandates it these days so it's time to upgrade from
pcc(1)!

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

-- 
Nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>