Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2002 16:25:57 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        Alexander@Leidinger.net, <cvs-committers@FreeBSD.org>, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/boot/i386/boot2 Makefile boot2.c
Message-ID:  <20021220160712.F35302-100000@gamplex.bde.org>
In-Reply-To: <20021219.214451.133959151.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 19 Dec 2002, M. Warner Losh wrote:

> In message: <20021220152016.H35037-100000@gamplex.bde.org>
>             Bruce Evans <bde@zeta.org.au> writes:
> : The removal of needed casts in strcmp() has not been backed out.
>
> They aren't needed.

They are needed for correctness and (currently) cost a whole zero bytes
at runtime and a whole 16 bytes in the source code.

> We only need to return == or != in the boot
> blocks, since strcmp is used in exactly one place to see if a string
> matches or not.

How do you know that?  You can know it today by looking at all the
callers, but the callers' requirements might change.  With the casts,
the compiler can and does look at the callers' requirements (since the
function is inline and the caller is gcc).  gcc notices that the casts
aren't needed (currently) and makes null changes to the object code
to them.  If the caller's requirements changed so that the subtractions
had to be done, then there would be non-null changes in the object
code which would normally cost no space since the sign-extension and
zero-extension instructions (movsbl and movzbl) take the same amount
of space.

The function should be called something different, e.g., broken_strcmp()
if it doesn't actually implement strcmp().

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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