C idioms [was: [cvs] main.c]

David Relson relson at osagesoftware.com
Tue Dec 17 13:22:18 CET 2002


At 07:08 AM 12/17/02, Matthias Andree wrote:
> >
> >  static void cleanup_exit(int exitcode, int killfiles) {
> > -    if (killfiles && *outfname) unlink(*outfname);
> > +    if (killfiles && outfname[0] != '\0') unlink(outfname);
> >      exit(exitcode);
> >  }
>
>Thanks for fixing the unlink(2) argument. The *outfname was fine
>though. :-]

Matthias,

It's one of several idioms that C allows that I think a bit odd.  Given 
that outfname is an array, it seems more appropriate to subscript it than 
treate it as a pointer.  Similarly, I'll use abc[3] rather than 3[abc], 
though the compiler considers them the same.  I'm a bit surprised that 
flawfinder and RATS don't consider it a style violation or something.

David





More information about the bogofilter-dev mailing list