Subject: Re: compiler tweak offered
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-toolchain
Date: 08/25/2002 09:41:43
>>       for "outer" (x=list; x; x=x->link) {
>>                       if (...) continue "outer";

> If I were designing new features for the C language, I'd probably
> want the loop label to be just like an ordinary label, thus:

>         outer:  for (x=list; x; x=x->link) {
>                         if (...) continue outer;

This is a reasonable idea.  My reasons for not doing it this way:

- You can't then have two loops with the same name in the same
  function; with my scheme, you can.  (They can even be one inside the
  other; continue and break will use the smallest enclosing construct
  with a matching name).

- I'd like to keep the namespace for these names separate from every
  other namespace; what you suggest would conflate its namespace with
  goto-target labels.  (This is related to my previous point.)

- This way looked a lot easier to implement. :-)

Another way that comes to mind is to introduce a new keyword, "named",
say, and write something like

	for named outer (...)
		... continue outer; ...

but I don't like stealing another keyword from the user's namespace.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B