Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jul 2001 14:22:51 +0200 (CEST)
From:      Harti Brandt <brandt@fokus.gmd.de>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        <arch@FreeBSD.ORG>
Subject:   Re: -fno-builtin
Message-ID:  <Pine.BSF.4.33.0107091420430.17758-100000@beagle.fokus.gmd.de>
In-Reply-To: <Pine.BSF.4.21.0107092158160.87629-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 9 Jul 2001, Bruce Evans wrote:

BE>On 9 Jul 2001, Dag-Erling Smorgrav wrote:
BE>
BE>> Bruce Evans <bde@zeta.org.au> writes:
BE>> > Unfortunately, the inline function version doesn't work right, at least
BE>> > on i386's:  __builtin_strlen("foo") gives code that loads the constant
BE>> > result 3, but the inline strlen("foo") gives code that scans the string.
BE>>
BE>> What about a macro?
BE>>
BE>> #define strlen(s) __builtin_strlen(s)
BE>>
BE>> Would this work?
BE>
BE>I think it would work right except in broken code which "knows" that
BE>strlen isn't a macro, e.g.:
BE>
BE>	size_t (*p)(const char *s) = strlen;

Why is that broken? My last copy of the ISO-C draft specifically states,
that strlen is a function. (Not that I intend to use that construct. Just
beeing curious).

harti
-- 
harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private
              brandt@fokus.gmd.de, harti@begemot.org


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




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