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,13ab88b30e0f779d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-28 07:59:07 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uunet!sea.uu.net!sac.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: Efficient Matrix? User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Sat, 28 Dec 2002 15:58:43 GMT Content-Type: text/plain; charset=us-ascii References: <3e0b2a66_4@news.bluewin.ch> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:32359 Date: 2002-12-28T15:58:43+00:00 List-Id: Adrian Knoth writes: > Robert A Duff wrote: > > > Compilers are required to pack tightly in this case (one bit per Boolean > > component). I.e., Matrix'Component_Size will be 1 if there's a pragma > > Pack. See RM-13.2(9). > > Hmm? Looks like a compiler bug to me. It seems to me that RM-13.2(9) implies packed arrays of Boolean have 'Component_Size = 1. Don't you think so? > with Ada.Text_IO; use Ada.Text_IO; > > procedure bla is > > type MATRIX is array (Positive range <>, Positive range <>) of Boolean; > type POINTER_MATRIX is access all MATRIX; > > pragma Pack (MATRIX); > > type my_matrix is array (Positive range <>, Positive range <>) of Boolean; > > A : POINTER_MATRIX := new MATRIX (1 .. 10000, 1 .. 5000); > > begin > Put_Line (Integer'Image (MATRIX'Component_Size)); > Put_Line (Integer'Image (my_matrix'Component_Size)); > end bla; > > > adi@drcomp:/tmp$ ./bla > 8 > 8 > adi@drcomp:/tmp$ > > > It's got nothing to do with the fact that the thing is heap allocated, > > nor the fact that the bounds are not known at compile time. > > For the variable A it is even known, but I was not able to determine > a valuable difference in memory-comsumption. So what size is A.all? - Bob