On Fri, May 05, 2000 at 01:24:30PM -0400, rpjday wrote:
> On Fri, 5 May 2000, Ken Gosier wrote:
> 
> > 
> > --- Steve Borho <[EMAIL PROTECTED]> wrote:
> > > Speaking to just pure style, though, that while loop
> > > reminds me of the
> > > most efficient C snippet I've ever seen.  It's the
> > > standard implementation
> > > of strcpy.
> > > 
> > >     for (;*s;)
> > >       *d++ = *s++;
> > 
> > 
> > One question about this code snippet: Won't it fail to copy
> > the terminating '\0' into the target string?
> 
> while (*d++ = *s++) ;
> 
>   or something to that effect, as i recall.

Yeah, this is correct.  I shouldn't have written that code snippet without
my recommended daily allowance of coffee.

-- 
Steve Borho                       Voice:  314-615-6349
Network Engineer
Celox Networking Inc

Fortune of the day:
The avoidance of taxes is the only intellectual pursuit that carries any
reward.
                -- John Maynard Keynes


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to