Article View: comp.lang.modula2
Article #2221Re: DOS compilers
From: Jon Guthrie
Date: Thu, 17 Dec 1992 01:29
Date: Thu, 17 Dec 1992 01:29
58 lines
2296 bytes
2296 bytes
Andries Dippenaar (1:105/42) writes to All:
: >>>I need a DOS Modula-2 compiler that will pack subranges, for
: >>>example, [0..255] would be stored in 1 BYTE. The compiler
: >>>that I ues store it as an INTEGER.
>Most DOS compilers should -- for one I know that the TopSpeed
>compilers pack all data types into the smallest possible memory.
>You may select to override it here and there if you wish. I
>haven't got any experience with the Stony Brook compiler, but
>would expect nothing less of it.
As it happens, I left my the relevant Stony Brook manual at work. However, thanks to the wonders of OS/2, I can whip up a sample program right away.
This program:
MODULE PackTest;
FROM InOut IMPORT WriteCard, WriteString, WriteLn;
FROM SYSTEM IMPORT BYTE;
TYPE
SubRange = [0..255];
SubRangeArray = ARRAY SubRange OF SubRange;
VAR
Size : CARDINAL;
BEGIN
Size := SIZE(SubRange);
WriteString('The Size of the subrange [0..255] is ');
WriteCard(Size, 2);
WriteLn;
Size := SIZE(SubRangeArray);
WriteString('The size of an array [0..255] of that subrange is ');
WriteCard(Size, 2);
WriteLn;
Size := SIZE(BYTE);
WriteString('The Size of a byte is ');
WriteCard(Size, 2);
WriteLn
END PackTest.
When Compiled to an executable by SBM2 for OS/2 produces this output:
The Size of the subrange [0..255] is 2
The size of an array [0..255] of that subrange is 512
The Size of a byte is 1
I believe that I have selected all of the options properly. So, it appears that SBM2 does NOT pack small subranges into bytes even if there are arrays of those subrange values.
--
uucp: uunet!m2xenix!puddle!106!2000.25!Jon.Guthrie
Internet: Jon.Guthrie@p25.f2000.n106.z1.fidonet.org
Technical Details
Message-ID:
<31498.2B33FD36@puddle.fidonet.org>Path:
arc1-ca.pugleaf.net!sparky!uunet!psgrain!puddle!p25.f2000.n106.z1.fidonet.org!Jon.GuthrieShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!psgrain!puddle!p25.f2000.n106.z1.fidonet.org!Jon.Guthrie From: Jon.Guthrie@p25.f2000.n106.z1.fidonet.org (Jon Guthrie) Sender: ufgate@puddle.fidonet.org (newsout1.26) Newsgroups: comp.lang.modula2 Subject: Re: DOS compilers Message-ID: <31498.2B33FD36@puddle.fidonet.org> Date: Wed, 16 Dec 92 18:29:00 PDT Organization: FidoNet node 1:106/2000.25 - COMM Port One, Sugar Land TX Lines: 58