www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/27/10:25:21

Message-ID: <374D4F72.8D7F725B@Maths.UniNe.CH>
Date: Thu, 27 May 1999 15:58:10 +0200
From: Gautier <Gautier DOT deMontmollin AT Maths DOT UniNe DOT CH>
X-Mailer: Mozilla 4.04 [en] (Win95; I)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: typedef'ing a 24-bit integer
References: <37459ABF DOT FF51CA41 AT aaual DOT ualg DOT pt> <374C2C34 DOT F91FB02 AT aaual DOT ualg DOT pt>
NNTP-Posting-Host: pc12-130.unine.ch
Lines: 35
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Now I've tested... :
with text_io;

procedure test24bt is

  package iio is new text_io.integer_io(integer); use iio;

  type uint24_1 is range 16#0#..16#FFFFFF#;
  type uint24_2 is range 16#0#..16#FFFFFF#; for uint24_1'size use 24;

  type tau1  is array(integer range <>) of uint24_1; pragma pack(tau1);
  type tau21 is array(integer range <>) of uint24_2;
  type tau22 is array(integer range <>) of uint24_2; pragma pack(tau22);

  au1:  tau1 (1..1000);
  au21: tau21(1..1000);
  au22: tau22(1..1000);

  begin

    Put(au1'size);
    Put(au21'size);
    Put(au22'size);

  end;

Result is:

Spawning: C:\USERS\GAUTIER\ADA\TESTS\TEST24BT
      24000      32000      24000

So you even don't need the "for uint24_1'size use 24;" clause;
the pragma pack is needed for having packed array.

G.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019