new do-while syntax

Andrew Koenig ark at alice.UUCP
Tue Dec 20 00:37:13 AEST 1988


In article <1716 at buengc.BU.EDU>, bph at buengc.BU.EDU (Blair P. Houghton) writes:

> Pardon my two-cent kibbitz, but what's wrong with using the comma
> operator to do that for which it is ideally suited?

I can't use arbitrary statements with the comma operator:

	int i, status, count = 0;
	char temp[THINGSIZE];
	do {
		readthing(precious);
		++count;
		for (i = 0; i < THINGSIZE; i++)
			temp[i] = precious[i];
		status = munge(temp);
	} while (status) {
		for (i = 0; i < THINGSIZE; i++) {
			if (temp[i] != precious[i])
				printf ("munge changed element %d of line %d\n",
					i, count);
		}
	}

As I said before, it's way too late to get anything like this
into C now.  It's fun to think about, though.
-- 
				--Andrew Koenig
				  ark at europa.att.com



More information about the Comp.lang.c mailing list