Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!greg From: greg@utcsri.UUCP (Gregory Smith) Newsgroups: net.lang.c Subject: Re: Good code for sometimes shared case Message-ID: <2594@utcsri.UUCP> Date: Sun, 20-Apr-86 23:14:21 EST Article-I.D.: utcsri.2594 Posted: Sun Apr 20 23:14:21 1986 Date-Received: Tue, 22-Apr-86 10:13:25 EST References: <4695@topaz.RUTGERS.EDU> <2600045@ccvaxa> Reply-To: greg@utcsri.UUCP (Gregory Smith) Organization: CSRI, University of Toronto Lines: 22 Summary: In article <2600045@ccvaxa> aglew@ccvaxa.UUCP writes: >Structured programming != Gotoless programming Right on. What was really ironic about the original posting ( using if(0){...} ) was that it was obviously an attempt to avoid those satanic g*t*'s, and therefore wind up with structured code. However, the structure of the if's was twisted around the structure of the switch statement, so the result was worse (less structured) than being honest and using goto's. That was made possible by the lax rules applied to 'case' labels in C (as opposed to, say, Pascal). It was, in a way, analogous to while con1 ... if con2 ... end_while .. end_if Which could be made to work as a 'while' with a 'break' if compilers would allow it. I am not, of course, saying that they should. How about producing a warning if a case label is not *directly* inside the {}'s of the switch? -- "If you aren't making any mistakes, you aren't doing anything". ---------------------------------------------------------------------- Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg