On Thu, May 04, 2000 at 05:23:37PM -0700, Sam Bayne wrote:
> while (ac-- > 0 && n < MAXARG)
> dirs[n++] = *av++;
>
> 3. Stylistically, is that 'while' statement normal? It looks to
> me like a syntax mistake waiting to happen, but I'll code
> to that style if it's normal for C programmers. Coming
> from a mostly perl background that line would either be
> one line or enclosed in curly braces.
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++;
That while loop does the exact same thing, only it's copying an array of
character pointers instead of characters (with a bounds check for good
measure).
--
Steve Borho Voice: 314-615-6349
Network Engineer
Celox Networking Inc
Fortune of the day:
I use not only all the brains I have, but all those I can borrow as well.
-- Woodrow Wilson
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.