Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!athena.mit.edu!peter From: peter@athena.mit.edu (Peter J Desnoyers) Newsgroups: comp.lang.c Subject: Re: gotos Message-ID: <5087@bloom-beacon.MIT.EDU> Date: 3 May 88 22:55:16 GMT References: <64@lakart.UUCP> <490@sas.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: peter@athena.mit.edu (Peter J Desnoyers) Organization: Massachusetts Institute of Technology Lines: 31 In article <490@sas.UUCP> bts@sas.UUCP (Brian T. Schellenberger) writes: >(I would, however, support "break loop" for the special case of breaking out >of a while/do/for loop from inside of a nested "switch". I find the inability >to get out of there cleanly very annoying.) >-- > --Brian. >(Brian T. Schellenberger) ...!mcnc!rti!sas!bts I would consider the semantics of the switch statement to be the worst botch in the C language, obviously induced by reading lots of assembler code. Not to say that it's horrible, or anything, but 95% of the time I use a switch statement I don't use cases that fall through; whereas I find myself wishing I could use a switch to figure out how to break out of a loop a lot more than 5% of the time. (So far I've used gotos for this.) I would rather that the switch construct was used in the following way: switch (n) { case foo: statement_or_block case bar: } rather than overloading 'break' with two different meanings - one for switches, and another for do, while, and for loops. I would accept the use of 'continue' to fall through, even though the net aesthetic improvement would be zero. Of course, we can't change it now, and it's not too broken to use by any means... Peter Desnoyers peter@athena.mit.edu