C style & dbug package
Fred Fish
fnf at unisoft.UUCP
Tue Jan 29 14:58:08 AEST 1985
<====>
Kevin Szabo writes:
> In the very rare case of the following usage, the `else' clause
> will incorrectly bind to the `if(_db_on)' provided in the macro.
>
> if( some_thing_worth_noting_happens )
> DBUG_2( "interesting", "info" );
> else
> do the normal thing;
>
> Admittedly this program structure should really never occur, but it
> could surprise someone someday. The fix is to enclose the macro's
> in another set of {}.
Thanks Kevin for pointing out a possible subtle bug. Yes, this
program structure SHOULD never occur. I personally consider it poor
style to leave out "{}" pairs in any of the control constructs.
Regardless of my personal tastes (no accounting for taste :-)
the macros should be set up to not break code from sloppy programmers.
<MILD FLAME slightly relevant to subject>
I am appalled at the consistently low quality of most of the UNIX
utility source code. Functions that run for pages and pages, few
comments, many traps like the one above just waiting for someone
to add a line of code, lint output that is longer than the source
code itself, etc, etc, etc. There may be some neat algorithms
buried in there somewhere but I am tired of wading through the
slop looking for them. If AT&T doesn't want to take the time to
clean them up why don't they commission someone to do it for them?
<FLAME OFF>
-Fred
======================================================================
Just me talking folks, not my employer, my 12ft python, or speak'n'spell.
More information about the Comp.lang.c
mailing list