Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would have to agree. IMO it lends itself to cleaner code if you're working with NULL terminated lists, especially if you use a `for` when doing the iteration instead of a `while`:

    const char **a;

    for (a = job->accomplishments; *a; a++)
        printf(" - %s\n", *a);
And

    job_t *j;
    for (j = jobs; *j; j++)
        print_job(j);
The person who wrote this code seems to dislike `for`s for some reason it seems, these are pretty obvious places to use one IMO, using an index `i` or not. Doing it with a `while` separates out the initialization, condition, and increment in his code, and 'continue' won't work like you normally want it too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: