Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!mcnc!ecsvax.uncecs.edu!dukeac!wolves!ggw From: ggw@wolves.uucp (Gregory G. Woodbury) Newsgroups: comp.lang.misc Subject: Re: problems/risks due to programming language Message-ID: <1990Mar3.051019.13096@wolves.uucp> Date: 3 Mar 90 05:10:19 GMT References: <5432@crdgw1.crd.ge.com) <8103@hubcap.clemson.edu) <10811@june.cs.washington.edu) <806@enea.se> <5479@ur-cc.UUCP> <16039@haddock.ima.isc.com> Reply-To: ggw@wolves.UUCP (Gregory G. Woodbury) Followup-To: comp.lang.misc Organization: Wolves Den UNIX BBS Lines: 39 In article <16039@haddock.ima.isc.com> karl@ (Karl Heuer) writes: >I'm redirecting followups to comp.lang.misc. > >Definitions. Let `CX' be the language C with multiple valued cases, with >automatic break-switch at the end of each case block, and with the `break' >keyword denoting only the break-loop operation. `CX with jumpcase' is CX >with an explicit keyword to denote the fall-through operations (overriding the >default behavior of an automatic break-switch). > >Claim 3. CX with jumpcase would be better than C. ASSUMING that the multiple valued case is done "right", this is only moderately untrue. If a person really wants to have this, it is a simple matter to put a front-end between your code and the C compiler to fix-up the syntax. >Claim 4. CX itself would be better than CX with jumpcase (and hence better >than C); the extra keyword doesn't buy you enough to be worth adding, and it >would destroy the commutativity of case blocks, which is a useful property of >CX. Now here there is a severe problem. This assumes (like most language arguments) that the programmer doesn't care about having to repeat (a potentially large) block of code in order to handle certain situations. Given that many programmers do care about the efficiency and size of the code generated, it can be argued that CX (without jumpcase) is significantly less usefull than C. In certain classes of processing, you want to do something only slightly different and then do the same thing as something else. One could certainly program this as code to handle the difference and a subroutine call to the common code, and a case to just call the common code, but this begs the question of the tradeoff between simplicity of in-line code versus the cost of a subroutine call which is part of the judgement left to the programmer. -- Gregory G. Woodbury Sysop/owner Wolves Den UNIX BBS, Durham NC UUCP: ...dukcds!wolves!ggw ...dukeac!wolves!ggw [use the maps!] Domain: ggw@cds.duke.edu ggw@ac.duke.edu ggw%wolves@ac.duke.edu Phone: +1 919 493 1998 (Home) +1 919 684 6126 (Work) [The line eater is a boojum snark! ]