Re: bin/ln & WARNS=5

Bruce Evans <[email protected]> Tue, 16 Jul 2002 04:42:47 +1000 (EST)
Newsgroups gmane.os.freebsd.devel.audit
Message-ID <[email protected]>
On 15 Jul 2002, Dag-Erling Smorgrav wrote:

> Bruce Evans <[email protected]> writes:
> > That would break the possibly-intentional check for snprintf() failing.
> > (size_t)-1 >= sizeof(path), but !(-1 >= (int)sizeof(path)).
>
> Casting a value which one knows may be negative to an unsigned type is
> IMHO stupid.  If the check is intentional, it should be done
> explicitly.

Well, it is what the original code does implicitly (except on machines
where size_t is smaller than int; then size_t is promoted to int instead
of int to size_t).

Bruce


To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-audit" in the body of the message