Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2001 22:54:56 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
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 
Message-ID:  <20010912224439.B1472-100000@delplex.bde.org>
In-Reply-To: <20010911195414.7D4D5380A@overcee.netplex.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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