<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 06 Jan 1985 19:09:04 GMT
From   : Doug Hall <hall%ittral.uucp@BRL-TGR.ARPA>
Subject: Packed variables in Turbo Pascal

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
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>