Date: Wed, 7 May 2003 02:32:40 -0700 From: David Schultz <das@FreeBSD.ORG> To: "Jacques A. Vidrine" <nectar@FreeBSD.ORG>, Harti Brandt <brandt@fokus.fraunhofer.de>, Terry Lambert <tlambert2@mindspring.com>, freebsd-arch@FreeBSD.ORG Subject: Re: `Hiding' libc symbols Message-ID: <20030507093240.GA15754@HAL9000.homeunix.com> In-Reply-To: <20030506162352.GC78486@madman.celabo.org> References: <20030501182820.GA53641@madman.celabo.org> <20030505110601.H53365@beagle.fokus.fraunhofer.de> <20030506093754.B838@beagle.fokus.fraunhofer.de> <3EB7CC73.9C61C27E@mindspring.com> <20030506165850.Y601@beagle.fokus.fraunhofer.de> <20030506152605.GE77708@madman.celabo.org> <20030506175017.C631@beagle.fokus.fraunhofer.de> <20030506162352.GC78486@madman.celabo.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 06, 2003, Jacques A. Vidrine wrote: > On Tue, May 06, 2003 at 05:53:16PM +0200, Harti Brandt wrote: > > JAV>Or stated more agressively, the day the FreeBSD toolchain refuses > > JAV>to allow me to define my own version of strlcpy _for use by my > > JAV>application_ is the day I find another development platform. > > > > So if you 'hide' all the libc symbols you will to exactly that. > > Of course not. I can define strlcpy like so > > void > strlcpy(struct string *a, struct string *b) > { > if (a->size == 0) { > b->size = 0; > return; > } > /* really copy the string */ > } Hmm...but that program is broken. If someone overrides a symbol reserved by the C standard, he deserves whatever he gets. It is not unreasonable to expect applications to avoid using reserved symbols for thier own purposes. On the other hand, if someone who knows what he is doing wants to override malloc() or printf() or *any* other standard function for a specialized purpose, it is desirable that he be able to do that in a semi-portable way (i.e. without having to know about the underscores). Note that my definition of knowing what you're doing includes making sure that the new function has the same external API as the old one. For instance, I might override malloc() to maintain statistics for me, or printf() (not sprintf()!) to do some specialized formatting.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030507093240.GA15754>