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,d02eb5c33ac65d9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-09 03:57:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.airnews.net!cabal12.airnews.net!usenet From: "John R. Strohm" Newsgroups: comp.lang.ada Subject: Re: Array and memory usage Date: Sun, 9 Mar 2003 05:52:06 -0600 Organization: Airnews.net! at Internet America Message-ID: <2397C8D4BA396B7A.ADB0E590CE8E5EAE.1C7AEC9AFCA7BE12@lp.airnews.net> X-Orig-Message-ID: References: Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library2.airnews.net NNTP-Posting-Time: Sun Mar 9 05:56:30 2003 NNTP-Posting-Host: !aH!V1k-X$S90*o (Encoded at Airnews!) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:35086 Date: 2003-03-09T05:52:06-06:00 List-Id: "Preben Randhol" wrote in message news:slrnb6m8mg.15o.randhol+news@kiuk0152.chembio.ntnu.no... > I was a bit puzzeled to see that if I do: > > type Str_Array_Type is array (1 .. 1000) of String (1 .. 800); > > type User_Data is > record > Name : Str_Array_Type; > Hostname : Str_Array_Type; > end record; This declares two types and NO instances of those types. > my program uses 800 bytes of memory, while if I only change the program > like this: > > type User_Data is > record > Name : Str_Array_Type := (others => (others => ' ')); > Hostname : Str_Array_Type := (others => (others => ' ')); > end record; > > then the program uses 2356 bytes. This declares the same two types and TWO (2) implicit instances of Str_Array_Type, namely, the aggregate constants. That's where the difference comes from.