Comparing strings...

Blair P. Houghton bhoughto at cmdnfs.intel.com
Wed Oct 24 02:22:53 AEST 1990


In article <444 at mole-end.UUCP> mat at mole-end.UUCP (Mark A Terribile) writes:
Andrew Koenig (ark at europa.att.com) writes
>> > 	for (; *s && *s == *t; s++,t++);
>
>Note the semicolon on the  for(;;) .  Note that it's hard to note.
>
[Mark prefers]
>	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.

But Mark, I, and the Indian Hills cats, and cb(1)[*],
all expect our braces attached to our pants thusly:

	while (...) {
	}

which smells of something forgotten (or preempted).

Much more exact:

	while (...)
	    ;	/* empty */

You'll never, ever misconstrue that sucker as an error-in-editing.

				--Blair
				  "'Dave?  Dave?
				   Scratch lower, Dave...'
				   -if HAL9000 had won..."

[*] Actually, vanilla cb(1) will leave		while(){
						}

alone, while it'll split the braces in		while()
						    {}

and move them back under the initial:		while()
						{
						}



More information about the Comp.lang.c mailing list