Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!lavaca.uh.edu!uhnix1!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: problems/risks due to programming language Message-ID: Date: 23 Feb 90 17:25:15 GMT References: <1597@awdprime.UUCP> <8133@hubcap.clemson.edu> <10839@june.cs.washington.edu> Reply-To: peter@ficc.uu.net (Peter da Silva) Organization: Xenix Support, FICC Lines: 41 With apologies to all the people tired of Bill Wolfe's Adaphilic C-bashing, the people arguing that you *need* break are all wet. Observe: switch(c) { case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': digit(); default: not_a_digit(); } On the other hand, the people (inlcuding Bill) arguing that switch...break is an unalloyed disaster are also all wet. The C SWITCH is not a Pascal CASE, it's a computed goto: switch(c) { case '%': stuff... break; case '$': stuff... break; case '\\': nextc = getchar(); if(nextc == '%' || nextc == '$') c = nextc; else ungetc(nextc, stdin); /* FALLTHROUGH */ default: lots... of... stuff... break; } The right solution for Next C (whether it be P or D) is to defang break by using a different keyword for breaking from a switch or exiting from a loop. I would suggest that 'break' be given a mandatory keyword argument: either 'break switch', 'break for', and so on. -- _--_|\ Peter da Silva. +1 713 274 5180. . / \ \_.--._/ Xenix Support -- it's not just a job, it's an adventure! v "Have you hugged your wolf today?" `-_-'