bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vasnprintf.c: Remove some compiler warnings.


From: Werner LEMBERG
Subject: Re: vasnprintf.c: Remove some compiler warnings.
Date: Tue, 03 Mar 2015 06:20:45 +0100 (CET)

> Generally speaking the compiler warnings you're talking about cause
> false alarms so often that they're more trouble than they're worth.
> For example, if P and Q are pointers into the same array and P <= Q,
> it's quite normal to compute Q-P and store the result into a size_t
> variable.

No question about this.

> Although I'm not sure why you selected the casts in question to
> attack first,

Because there were casts already.

> for casts to unsigned char how about the attached patch instead?
> The general idea is to avoid casts when possible, as they're too
> powerful in C.  The characters in question are all ASCII so sign
> extension shouldn't matter.

Looks OK to me.  I wished there were possibilities to improve compiler
warnings so that trivial cases like this one (and especially the
`size_t' issue you are mentioning above) don't cause a warning...


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]