From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8247c32bb1260c74 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-23 01:08:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!62.2.203.231!not-for-mail From: Vinzent Hoefler Newsgroups: comp.lang.ada Subject: Re: Q re pack & aliased Date: Wed, 23 Apr 2003 10:07:55 +0200 Organization: JeLlyFish software Message-ID: References: <63lpa.48072$Si4.30616@rwcrnsc51.ops.asp.att.net> NNTP-Posting-Host: 62.2.203.231 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: fu-berlin.de 1051085308 6887428 62.2.203.231 (16 [175126]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:36394 Date: 2003-04-23T10:07:55+02:00 List-Id: tmoran@acm.org wrote: > The case at hand is a DIBitmap in Windows. It needs to be in packed, = 24 >bit, format so I can pass it to Windows (not to mention size >considerations). I also need sometimes to make pointers to individual >elements, so the components need to be aliased. Well, why don't you do this, then? |with Ada.Text_IO; | |procedure t is | type color is range 0 .. 2**8 - 1; | for color'Size use 8; | | type triples is record | red, | green, | blue : color; | end record; | for triples'Size use 24; | | type bunches is array (Integer range <>) of aliased triples; | x : bunches (1 .. 10); | for x'Size use 240; |begin | x :=3D (1 =3D> (red =3D> 0, green =3D> 1, blue =3D> 1), others =3D> = (0, 0, 0)); | Ada.Text_IO.Put_Line (Integer'Image (x'Size / 80) | & " should =3D 3, not 4"); |end t; Probably some of the 'Size-attributes are not needed here (especially the "x'Size use 240"-one), but I put them in to see if the compiler warns about any of them. It doesn't and the generated code for the assignment looks correct to me, too. I don't know how this would fit into your existing code, but I guess, a conversion between a 24-bit-type like you used before and the triples-record is quite easy without breaking too much... Vinzent. --=20 Parents strongly cautioned -- this posting is intended for mature audiences over 18. It may contain some material that many parents would not find suitable for children and may include intense violence, sexual situations, coarse language and suggestive dialogue.