Re: Little code cleanup
On 2008-03-03 17:42:01 +0100, Sébastien Hinderer wrote:
> 1. I'm also _very_ interested in a warning-free compilation, because if
> the habit is to have no warnings at all, then each single warning which
> appears in the future is much more easy to notice. If it appears in a
> long list of warnings, chances are high that I (and perhaps others)
> won't notice it.
I agree, but the best fix should be in gcc (BTW, sometimes one can't
avoid the test without bloating the C source: this is what happens
in MPFR, where the identifier is used via a macro argument and is
sometimes a pointer, which can be null, and sometimes an array).
> 2. It is true that testing pointers may avoid segfaults, but they don't
> avoid problems. What I mean is that, if a pointer becomes NULL whereas
> it should not, having a segfault makes it much easier to debug the
> problem, IMHO, than having a leading to some fallback behaviour.
But pointers can be null by designed. If I understand correctly,
some null pointers in Mutt are equivalent to empty strings. IMHO,
this would be best handled in functions instead of the caller
(though this may hide bugs in some cases).
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)