Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!rpi!brutus.cs.uiuc.edu!wuarchive!texbell!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: 26 Feb 90 15:28:35 GMT References: <8145@hubcap.clemson.edu> Reply-To: peter@ficc.uu.net (Peter da Silva) Organization: Xenix Support, FICC Lines: 33 First of all, my point about gotos had nothing to do with your point about gotos. In article <8145@hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu writes: > Many (including Peter) have re-observed that this is the way C's switch > currently operates, but to date nobody has provided any justification for > having it continue to operate that way. I'm not going to bother continuing this discussion. The very article you were referencing shows an example of how the C switch construct may be profitably used. I can show you the working code I based that example on, if you like. By all means make 'break' the default... but provide a convenient (not involving explicit gotos) method of falling through to the next case. The construct you seek has existed in C from the beginning: #define CASE switch { #define WHEN break; case #define OR : case #define DO : #define OTHERWISE default: #define ESAC } CASE (language) WHEN ADA OR COBOL DO blame the DOD; WHEN C OR FORTH DO blame people who wanted to get real work done instead of building more beauracracy; OTHERWISE see appropriate ANSI standards; ESAC -- _--_|\ 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?" `-_-'