<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 08 Jan 1985 11:52:11 PST (Tue)
From   : Alastair Milne <milne@Uci-Icse.ARPA>
Subject: Re: 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

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