Re: [hackers] [sbase] Audit printenv(1) || FRIGN

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Sun, 1 Mar 2015 08:01:18 +0100

> On Sat, 28 Feb 2015 13:25:09 -0800
> Evan Gates <evan.gates_AT_gmail.com> wrote:
>
>> The arg loops can simply be for (; *argv; argv++) as the standard
>> guarantees argv[argc] is NULL.
>
> Hey Evan,
>
> I discussed this with stateless and we came to the conclusion that
> the argc-approach is more idiomatic.

In this case I agree with Evan, and I see the argv loop idiomatic.
I have seen in several books and in diferent sources. I usually
do the argv loop:

        for (++argv; *argv; ++argc)

                or

        while (*++argv)

and if I need do a test argc > something then I update the value of argc
in the body. If I only need argc > 0 I use *argv != 0.


Regards,
Received on Sun Mar 01 2015 - 08:01:18 CET

This archive was generated by hypermail 2.3.0 : Sun Mar 01 2015 - 08:12:08 CET