Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!genrad!teddy!panda!talcott!harvard!seismo!brl-tgr!tgr!milne@Uci-Icse.ARPA From: Alastair MilneNewsgroups: net.micro.cpm Subject: Re: Packed variables in Turbo Pascal Message-ID: <7113@brl-tgr.ARPA> Date: Tue, 8-Jan-85 15:06:01 EST Article-I.D.: brl-tgr.7113 Posted: Tue Jan 8 15:06:01 1985 Date-Received: Fri, 11-Jan-85 07:20:50 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 58 > While messing around with Turbo Pascal last night I typed in the > following short program: > | program testvars; > | > | var a : packed array [0..15] of boolean; > | b : set of 0..15; > | > | begin > | writeln(sizeof(a),' ',sizeof(b)); > | end. > The result was that variable 'a' took 16 bytes and 'b' took 2 bytes. A > quick check of the manual revealed that the word 'packed' is ignored > in Turbo; packing occurs automatically whenever possible. It certainly > seems possible for packing to occur here. There is a compiler > directive (*X- *) which supposedly causes the code size for arrays to > be minimized, but the size is unchanged when I use this. It appears > that Turbo is tuned for maximum speed, not minimum code size. Sets, > however, use one bit per element, just as in UCSD Pascal. > Could someone try this on the 8088/8086 version of Turbo? I'm using > the CP/M version on an Apple //e with a Z-80 card. > While we're on the subject, has anyone received info on new compilers > from Borland? I keep hearing rumors of a Modula-2 compiler and an > upgraded version of the Pascal compiler. Any news? > Douglas Hall > ITT Telecom Products > Raleigh, NC > ittvax!ittral!hall ---------------- I have Turbo on an 8088. It's the same story. Turbo packs to the byte level only; I'm told this is typical of Pascal implementations. UCSD is one of the few that packs to the bit level. I did my test in a different way: a case variant record where one variation was an array of boolean, by which I wanted to access the bits of the other variation. No good. I had an array of bytes where I wanted bits. Yes, Turbo's optimisation is definitely for speed; I believe they state as much. I'm not sure, though, whether $X- is the right setting for optimised arrays. Are sure that's not actually the default setting? As far as I'm aware Turbo's sets are bit vectors. I think (hope, certainly) that this is also typical of Pascal implementations (else why impose such a ridiculous restriction as a 32-element set?). I too am eagerly awaiting reports of Borland's Modula-2. Having separately compilable modules will make a great difference to me. And with luck, the reams of additional features stuffed into Turbo will be separated into modules. (Have you considered what the Turbo compiler's symbol must look like, not to mention the code to initialize it?!) A. Milne