From owner-cvs-all  Wed Sep 12  5:55:32 2001
Delivered-To: cvs-all@freebsd.org
Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16])
	by hub.freebsd.org (Postfix) with ESMTP
	id 9CCCA37B405; Wed, 12 Sep 2001 05:55:26 -0700 (PDT)
Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102])
	by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id WAA15410;
	Wed, 12 Sep 2001 22:55:18 +1000
Date: Wed, 12 Sep 2001 22:54:56 +1000 (EST)
From: Bruce Evans <bde@zeta.org.au>
X-X-Sender:  <bde@delplex.bde.org>
To: Peter Wemm <peter@wemm.org>
Cc: "Brian F. Feldman" <green@FreeBSD.org>,
	Mark Murray <mark@grondar.za>, <cvs-committers@FreeBSD.org>,
	<cvs-all@FreeBSD.org>
Subject: Re: cvs commit: src/sys/kern subr_prf.c src/sys/sys systm.h 
In-Reply-To: <20010911195414.7D4D5380A@overcee.netplex.com.au>
Message-ID: <20010912224439.B1472-100000@delplex.bde.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-cvs-all@FreeBSD.ORG
Precedence: bulk
List-ID: <cvs-all.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20cvs-all>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20cvs-all>
X-Loop: FreeBSD.ORG

On Tue, 11 Sep 2001, Peter Wemm wrote:

> Bruce Evans wrote:
> > Disagreed.  This seems like a normal optimization to me.  It's like
> > replacing strlen("foo") by 3.
>
> This is bogus too.  Who says that strlen("foo") returns three in the library
> I am linking with?

The C standard :-).

> These optimizations should only be activated if #include <string.h>
> or #include <stdio.h> and there is some sort of attribute marker on
> the functions being optimized.

Perhaps to be kind to external implementations, but the C standard permits
the implementation (compiler + possibly-external) to implement extern
interfaces like strlen() in any way that meets the requirements of the
standard.

> Unless I #include <string.h>, then strlen() is not any of the compiler's
> business.  Unless I #include <stdio.h>, then printf() is not any of the
> compiler's business.  Otherwise any under-the-table substitutions are
> bogus.  These functions are not part of the core language spec, they are
> something that is introduced as part of the optional includes and standard
> c library.

This only holds for things like "NULL" which are only reserved if a relevant
header is included (or in the freestanding case).  In the hosted case, the
library non-optional.

Bruce


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