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:22:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!west.cox.net!cox.net!news-hub.cableinet.net!blueyonder!internal-news-hub.cableinet.net!news-binary.blueyonder.co.uk.POSTED!53ab2750!not-for-mail User-Agent: Microsoft-Entourage/10.1.1.2418 Subject: Re: Efficient Matrix? From: Bill Findlay Newsgroups: comp.lang.ada Message-ID: References: <3e0b2a66_4@news.bluewin.ch> Mime-version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Date: Sat, 28 Dec 2002 15:21:52 +0000 NNTP-Posting-Host: 80.195.52.70 X-Complaints-To: abuse@blueyonder.co.uk X-Trace: news-binary.blueyonder.co.uk 1041088925 80.195.52.70 (Sat, 28 Dec 2002 15:22:05 GMT) NNTP-Posting-Date: Sat, 28 Dec 2002 15:22:05 GMT Organization: blueyonder (post doesn't reflect views of blueyonder) Xref: archiver1.google.com comp.lang.ada:32358 Date: 2002-12-28T15:21:52+00:00 List-Id: On 28/12/02 13:00, in article slrnb0r842.2n7.adi@drcomp.erfurt.thur.de, "Adrian Knoth" wrote: > 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). > [snip] > >> 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. > I get good results as follows, with GNAT 5.00w for MacOS X. ----------------------------------------------------------- with Ada.Text_IO; use Ada.Text_IO; procedure bla is type unconstrained_type is array (Positive range <>, Positive range <>) of Boolean; for unconstrained_type'Component_Size use 1; pragma Pack (unconstrained_type); subtype constrained_type is unconstrained_type (1 .. 10000, 1 .. 5000); type constrained_type_ptr is access constrained_type; A : constrained_type_ptr := new constrained_type; begin Put_Line (Integer'Image (constrained_type'Component_Size)); Put_Line (Integer'Image (unconstrained_type'Component_Size)); Put_Line (Integer'Image (constrained_type'Size)); Put_Line (Integer'Image (A.all'Size)); end bla; ---------------------------------------------------------------- % ./bla 1 8 50000000 50000000 ---------------------------------------------------------------- -- Bill-Findlay chez blue-yonder.co.uk ("-" => "")