From: <lm...@bi...> - 2006-11-06 14:55:45
|
> >I'm not saying it isn't but we're a 95% pure C shop and we should > >be seeing > >this all the time but we don't. Are we that much better than average? > > Do you compile your C code with -Wall? If you don't, why not? Yup. > Do you have a requirement to remove all warnings before shipping? Requirement? No. We just do it as a matter of course. And you can't remove all warnings, we have one that is legit. > What do you do with > > x.c:4: warning: suggest parentheses around assignment used as truth > value > > ??? We disable that warning, it was too annoying. For what it is worth, it is almost always something like unless (f = fopen(file, mode)) { err: if (f) fclose(f), f = 0; if (mem) free(mem); if (this) that(); return (-1); } unless (mem = malloc(whatever)) goto err; You get the idea, all the exit handling in one spot. I'm getting the distinct sense we review our code a lot more than average. Rather than code not going out with compiler warnings, our code doesn't go out unreviewed. > If you want this kind of checking in Tcl, you have to make the > assignment token significantly visually different. You complain all > the time about making Tcl "better". Here is an area that every C > programer will agree is a "mistake" in C, and you have a chance to > avoid the same mistake, so why not take advantage of it? I suppose. In general, I think this one is so far down the priority list compared to other stuff that I'm surprised anyone cares enough to fuss about it. Perhaps it's the bikeshed effect again. -- --- Larry McVoy lm at bitmover.com http://www.bitkeeper.com |