From owner-cvs-all Thu Dec 19 21:25: 1 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3064337B401; Thu, 19 Dec 2002 21:25:00 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id E999D43EE8; Thu, 19 Dec 2002 21:24:58 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id QAA05091; Fri, 20 Dec 2002 16:24:42 +1100 Date: Fri, 20 Dec 2002 16:25:57 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "M. Warner Losh" Cc: Alexander@Leidinger.net, , Subject: Re: cvs commit: src/sys/boot/i386/boot2 Makefile boot2.c In-Reply-To: <20021219.214451.133959151.imp@bsdimp.com> Message-ID: <20021220160712.F35302-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 19 Dec 2002, M. Warner Losh wrote: > In message: <20021220152016.H35037-100000@gamplex.bde.org> > Bruce Evans 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