> --- 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?

Well, first, it's not really what I'd consider the classic
strcpy:

        while (*d++ = *s++);

That one will copy the null on the last iteration (the one
that fails the test).

Mike McNally | Turtle, turtle, on the ground,
[EMAIL PROTECTED] | Pink and shiny, turn around.
 


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

Reply via email to