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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,803df5f3f60558d5 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Uninitialized "out" parameters Date: 1996/07/24 Message-ID: #1/1 X-Deja-AN: 169950774 references: <31EEACDA.64880EEB@sage.inel.gov> <4t1s3n$chv@goanna.cs.rmit.edu.au> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-07-24T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >I have an array of 2 gigabytes in an allocate-on-demand environment. I use >this as a sparse hash table, but it is critical that only pages that are >actually used get referenced, so it is out of the question to initialize >the table. I don't understand your example. A hash table normally has an operation for determining whether a given item is in the table, and this operation is going to have to read pages that have never been written. So, the allocate-on-demand feature needs to zero out pages upon allocation, or somehow set them to a well-defined value. If I write: Table: Giant_Array := (others => null); I believe the DEC Ada compiler on VAX/VMS will notice that null is zero, and not actually zero out the whole array, but rely on the fact that the operating system will zero out each page as it is allocated. Is this not true? Are there any other Ada compilers smart enough to do this (presuming the underlying OS supports allocate-on-demand)? (Actually, if it's an array of pointers, it will be initialized to null without the aggregate -- we had a big argument here a while back about that.) By the way, a few months ago I wrote a program, and it was running too slow, so I profiled it, and found that it was spending a huge percentage of its time setting access values to their default null value, in cases where I could prove this to be unnecessary. I actually resorted to a pretty ugly hack to get the compiler to quit generating those initializations. I was using GNAT on Linux. - Bob