Breaking out of several nested loops (& ANSI C)

Gino Bloch gino at voder.UUCP
Tue Oct 16 06:40:56 AEST 1984


[this is a broken loop]

Well, I have an opinion too.  I imagine trying to find WHERE the break or goto
takes me to.  Assume that I have a listing or an editor without the `%' command.
I think it's easier to guess what happens with this:
	while (...)
	    {
		{
		    {
			{
			...
			goto bkpt;
			}
		    }
	    bkpt: ...
		}
	    }


than it will be with this:
	while (...)
	    {
		someloop: while (...)
		{
		    {
			{
			...
			break someloop;
			}
		    }
		}
	    }

Except, of course, in simple cases that aren't very deeply nested - but those
cases are easy anyway.
-- 
Gene E. Bloch (...!nsc!voder!gino)



More information about the Comp.lang.c mailing list