Richard Braun, le Mon 09 Dec 2013 11:28:24 +0100, a écrit :
> On Mon, Dec 09, 2013 at 11:07:46AM +0100, Marin Ramesa wrote:
> > On 09.12.2013 11:00:12, Richard Braun wrote:
> > > On Mon, Dec 09, 2013 at 08:20:11AM +0100, Marin Ramesa wrote:
> > > > On 08.12.2013 15:25:42, Samuel Thibault wrote:
> > > > > Marin Ramesa, le Mon 02 Dec 2013 22:54:39 +0100, a écrit :
> > > > > > -for ( ; (c != K_DONE) && (char_idx <= max);
> > > > > > +for ( ; ((char)c != K_DONE) && (char_idx <= max);
> > > > > 
> > > > > I have rather made K_DONE an unsigned, simply.  It definitely has
> > > > > to be an unsigned anyway, since it's 0xff...
> > > > 
> > > > There's still a warning from GCC, even after the change. I don't 
> > > > know why GCC complains about this comparison. Everything looks 
> > > > good to me now. Here's the warning:
> > > > 
> > > > cc1: warning: assuming signed overflow does not occur when assuming 
> > > > that (X - c) <= X is always true [-Wstrict-overflow]
> > > 
> > > Remove your explicit cast, make K_DONE an unsigned.
> > 
> > I have removed it and Samuel made it unsigned and there is still a 
> > warning.
> 
> Could the warning apply to char_idx and max instead ?

No, it's really commenting c != K_DONE which makes the warning away. My
current guess is that c gets implicitly casted to int instead of
unsigned int.

Samuel

Reply via email to