Style (was: C-DATABASE B-PLUS a quick look)
Wayne A. Throop
throopw at xyzzy.UUCP
Thu Dec 29 03:47:38 AEST 1988
As larger nits have lesser nits
Upon their backs to bite 'em,
The lesser have still lesser nits,
And so ad infinitum.
Chris Siebenmann (ziebmef!cks) reminds that my "correction" of an
earlier code fragment is itself flawed. I had a loop as
#include <ctype.h>
char *p, *s;
...
for( p = s; *p; ++p )
*p = toupper( *p );
Nearly as I can tell, dpANS says that loop ought to have been
for( p = s; *p ++p )
if( *p >= 0 )
*p = toupper( *p );
because all functions defined in ctype.h take arguments that
are integers, but give defined results only if those integers have
values representable as unsigned integer (or are the constant EOF).
Thus, the test for negative values is (I *think*) necessary. Unless,
of course, you are willing to otherwise ensure that s only points at
strings of vanilla characters... then the loop is OK as it was.
--
The program itself is the only complete description
of what the program will do.
--- P.J. Davis
--
Wayne Throop <the-known-world>!mcnc!rti!xyzzy!throopw
More information about the Comp.lang.c
mailing list