This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: compiler tweak offered


> Plain old identifiers would certainly be preferable to strings; I'm
> pretty sure that avoids changing the meaning of any currently valid C
> program.

Just switching what I have over from strings to identifiers actually
makes it worse.  Adding the < > fixes it, but it does so just as
effectively whether it's a string or a bare identifier inside the < >.

Unless someone can come up with a way for a statement to begin with <,
which I don't expect.

>>>   outer: for (elt=root; elt; elt=elt->link)
>>> 		 if (...) continue outer;
>> (1) it means you can't have a given loop name more than once in a
>> given function and (2) it would open up that target to gotos as well
>> as continues and breaks.
> (2) I don't see as being a problem; it is unambiguous what 'goto
> outer' means.

Oh, certainly.  That's not why (2) is a problem.  It's a problem
because it means you can't do anything with the label without checking
the whole function to make sure nothing else goes to it.  With loop
names that are nothing but loop names (whatever the syntax is), the
scope of the loop's name is the loop, and attempts to refer to it from
outside the loop will either error out or refer to something else; your
checking need not extend outside the loop body.

Unless you propose to permit break and continue statements to refer to
loops they are not within, which I think would be absolute insanity.

> You explained elsewhere why you wanted to give more than one block in
> the same function the same name, but I have to say I find it only a
> source of confusion.

*shrug*  So we disagre on what's clearer; this is no particular
surprise.  I think it's clearer to be able to write

	case A:
		for "foo" (foo=foo_root;foo;foo=foo->link)
		 { ... }
		break;
	case B:
		if (...)
		 { for "foo" (foo=foo_root;foo;foo=foo->link)
		    { ... }
		 }
		else
		 { for "foo" (foo=foo_root;foo;foo=foo->link)
		    { ... }
		 }
		break;
	case D:
		for "foo" (foo=foo_root;foo;foo=foo->link)
		 { ... }
		break;

and risk some noodlehead calling all loops the same thing or some such
than to have to invent unique names for all those loops.  (Especially
given how hard it is to do the latter in a macro expansion.)

For my own use, in any case, suggestions I am not competent to
implement are not an option, unless someone else is willing to do them
for me.  (Using ordinary labels is an example, quite aside from all the
other reasons I didn't do it that way.)

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]