Comparing strings...

Floyd Davidson floyd at hayes.ims.alaska.edu
Wed Oct 24 13:31:03 AEST 1990


In article <444 at mole-end.UUCP> mat at mole-end.UUCP (Mark A Terribile) writes:
>IMnsHO, the semicolon null statement is one of the more irritating glitches
>in C.  I prefer
>
>	for( ; *s && *s == *t; s++, t++ )
>		{}
>
>or
>
>	while( . . . )
>		{}
>
>It's quite clear that this is an empty, no-effect statement.  It's a brace-
>thing where you expect a brace-thing, and it won't get missed on a faint
>printout the way a semicolon can be.

A simple alternative:

	for ( ... ) {
		/* null statement */;
	}

Reformat to whatever style of indents or braces pleases your taste.

Floyd


-- 
Floyd L. Davidson      floyd at hayes.ims.alaska.edu
8347 Richardson Hwy.   floydd at chinet.chi.il.us
Salcha, AK 99714       [and related to Alascom, Inc. by a pay check, only]



More information about the Comp.lang.c mailing list