Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Nov 1999 19:36:13 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        obrien@freebsd.org
Cc:        rjesup@wgate.com, freebsd-arch@freebsd.org
Subject:   Re: stpcpy()
Message-ID:  <199911011936.MAA29291@usr02.primenet.com>
In-Reply-To: <19991029234654.B89583@dragon.nuxi.com> from "David O'Brien" at Oct 29, 99 11:46:55 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> On Fri, Oct 29, 1999 at 03:58:14PM +0000, Randell Jesup wrote:
> > 	stpcpy() (the issue in this case) is something I've seen in
> > compiler's C libraries since the late 80's/early 90's (if I remember
> > correctly), if I remember correctly.  Quite honestly, it's useful
> ...
> > 	It's handy and improves performance for the cases where it's
> 
> Why is it so useful and "improves" performance so much??  I'll only
> believe this when I see some perf traces.  Strings don't tend to be very
> long ( < 256).  Thus an c*O(n), where c = (2 + 1 function call) doesn't
> sound like a big savings.  Especially in the face of portability.
> 
> I really think 99% of the programs using stpcpy() for "speed" reasons
> would spend 99% of their time elsewhere if p=strchr(strcpy(d,s), '\0');
> were used.

I believe the point is to iterate the string once, instead of twice,
without having to learn how to use pointers yourself.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.




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?199911011936.MAA29291>