Concurency in C

Steven M. Haflich smh at mit-eddie.UUCP
Tue Jan 1 01:54:39 AEST 1985


In article <6856 at brl-tgr.ARPA> Bob Larson <BLARSON%ECLD at usc-ecl.ARPA> writes:

>2) {{ and }} bracket a set of concurrently executed statements, that
>may be executed concurrently or sequentially in any order.  The compound
>statement thus formed will be considered terminated only when all statements
>inside it have been completed.

The {{ ... }} construction can usefully appear in existing C code, for
instance, to localize and economize register allocations:

	/* Clean up once a week. */
	if (Thursday) {
		{	register struct hearth *ph;
			for (ph = fireplaces; *ph; ph++) clean_hearth(ph);
		}
		{	register struct oven *po;
			for (po = ovens; *po; po++) clean_oven(po);
		}
	}

Here the compiler cannot figure out what kind of bracket it has until it
sees the second inner compound statement.  If you intend the
two-character token to be lexigraphic (i.e. `{{' without intervening
whitespace) rather than syntactic, it is less of a problem, but still I
would resist adding any new fuzziness to the boundary between C's lexer
and parser.  We should have learned from "lvalue=-value".

I could suggest `{[' and `]}', since `[' cannot legitimately (I think)
start a statement, and the proper pairing a `]}' sequence with either
separate `{' and `[' or a single `{[' can unambiguously be determined
from the parse stack.  Unfortunately, this punctuation is visually ugly.



More information about the Comp.lang.c mailing list