Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jul 2002 04:42:47 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        Giorgos Keramidas <keramida@FreeBSD.ORG>, <freebsd-audit@FreeBSD.ORG>
Subject:   Re: bin/ln & WARNS=5
Message-ID:  <20020716044123.B41571-100000@gamplex.bde.org>
In-Reply-To: <xzp65zh9rdx.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On 15 Jul 2002, Dag-Erling Smorgrav wrote:

> Bruce Evans <bde@zeta.org.au> 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 majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020716044123.B41571-100000>