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 X-Google-Thread: 103376,13ab88b30e0f779d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-28 05:30:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!news0.de.colt.net!blackbush.xlink.net!blackbush.de.kpnqwest.net!news.erfurt.igrz.de!drcomp.erfurt.thur.de!not-for-mail From: Adrian Knoth Newsgroups: comp.lang.ada Subject: Re: Efficient Matrix? Date: 28 Dec 2002 13:00:50 GMT Organization: Modern Electronics Message-ID: References: <3e0b2a66_4@news.bluewin.ch> NNTP-Posting-Host: drcomp.erfurt.thur.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Server-Date: 28 Dec 2002 13:00:50 GMT User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:32356 Date: 2002-12-28T13:00:50+00:00 List-Id: 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? 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. -- mail: adi@thur.de http://adi.thur.de PGP: v2-key via keyserver Praktisch denken, S�rge schenken