[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: oops? read/write vs type of length parameter
From: |
Eli Zaretskii |
Subject: |
Re: oops? read/write vs type of length parameter |
Date: |
Mon, 11 Apr 2011 17:02:43 +0300 |
> From: Jim Meyering <address@hidden>
> Cc: address@hidden
> Date: Mon, 11 Apr 2011 14:27:36 +0200
>
> > That would be a major inconvenience, and even annoyance: in Emacs, it
> > is a very frequent idiom to pass the result of subtracting two
> > EMACS_INT values, because we reference buffers and strings with such
> > values. Having the argument as unsigned type would trigger warnings
> > and will need explicit type casts. And with type casts, there's the
> > danger of interpreting a negative value as a large positive one.
>
> >From my experience with signedness-related warnings,
> it is counterproductive to enable options like -Wsign-conversion
> and -Wsign-compare, unless you're prepared to cherry-pick fixes for
> the few "real" problems and to ignore the others.
I agree, but unfortunately -Wall includes warnings about signedness,
and I sometimes use -Wall to make sure I didn't miss something
potentially bad. And there's no way of knowing what some future
version of GCC will do to save us from ourselves ;-)
> Adding casts to work around them makes the "cure" worse than the
> disease.
Right, which is why I didn't want to use them.
> What about when EMACS_INT is defined to "int"?
David answered that: the result would be less grave than the other way
around.
- Re: oops? read/write vs type of length parameter, (continued)
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/11
- Re: oops? read/write vs type of length parameter, Jim Meyering, 2011/04/11
- Re: oops? read/write vs type of length parameter, David Kastrup, 2011/04/11
- Re: oops? read/write vs type of length parameter, Jim Meyering, 2011/04/11
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/12
- Re: oops? read/write vs type of length parameter, Ted Zlatanov, 2011/04/12
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/12
- Re: oops? read/write vs type of length parameter, Ted Zlatanov, 2011/04/12
- Large file support (was: oops? read/write vs type of length parameter), Eli Zaretskii, 2011/04/12
- Re: oops? read/write vs type of length parameter, Michael Welsh Duggan, 2011/04/14
- Re: oops? read/write vs type of length parameter,
Eli Zaretskii <=
Re: oops? read/write vs type of length parameter, Stephen J. Turnbull, 2011/04/11
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/11
- Re: oops? read/write vs type of length parameter, Paul Eggert, 2011/04/11
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/11
- Re: oops? read/write vs type of length parameter, Paul Eggert, 2011/04/12
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/12
- Re: oops? read/write vs type of length parameter, Paul Eggert, 2011/04/12
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/12
- Re: oops? read/write vs type of length parameter, Paul Eggert, 2011/04/12
- Re: oops? read/write vs type of length parameter, Eli Zaretskii, 2011/04/12