Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!bfmny0!tneff From: tneff@bfmny0.UUCP (Tom Neff) Newsgroups: comp.sys.intel Subject: Re: PLM vs. C for 80286/80386 Keywords: PLM C Message-ID: <14395@bfmny0.UUCP> Date: 9 Jun 89 05:33:17 GMT References: <598@philtis.UUCP> <126@tridom.uucp> <5711@lynx.UUCP> Reply-To: tneff@bfmny0.UUCP (Tom Neff) Organization: ^ Lines: 47 In article <5711@lynx.UUCP> m5@lynx.UUCP (Mike McNally) writes: >The claim made that PL/M switch statements are always branch table >based is true, but of course that's easy when the case labels are >*always* 0 through N. And of course, if the selector is out of range, >the results are undefined (no such thing as default:). Structures >within structures? Sorry. Two dimensional arrays? Sorry. Macros >with arguments? Sorry. Truth Squad Dept.: * The original 'switch' claim had to do with iC, not PL/M, and the claim was that elseif was used when a jump table should have been. PL/M certainly uses jump tables on DO CASE -- this wasn't a claim, it's just a fact. * PL/M doesn't range check DO CASE for you automatically, it's your responsibility. This demands programmer responsibility but allows for extra speed in the case where the o/r *truly* "can't happen". * Structures within structures - available since PL/M 2.7 (1987). * 2-d arrays aren't available in the sense of A(i,j) but you have always been able to do this elegantly with structure arrays: DECLARE table (20) STRUCTURE( col (50) WORD); table(i).col(j) = x+y*5; Now with nested structures (for the last two years) you can generalize this to N-dimensional arrays if the mood strikes. * Macros with arguments are sadly missing from PL/M (all you get is the simple-replacement LITERALLY facility), however one is at liberty to preprocess PL/M source with either MPL86 or (now) the iC-x86 preprocessor before compiling. In fact I suspect the latter will become popular - you can have all the #defines you want and still get valid PL/M to compile. I use MPL86 based "macro PL/M" for a number of projects - it's the best way to automatically generate count precedent string constants, for instance. -- You may redistribute this article only to those who may freely do likewise. -- Tom Neff UUCP: ...!uunet!bfmny0!tneff "Truisms aren't everything." Internet: tneff@bfmny0.UU.NET