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-Thread: 103376,55a8252137b5ef97 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!not-for-mail From: gate02@wrandyke.demon.co.uk (Michael Mounteney) Newsgroups: comp.lang.ada Subject: Efficiently setting up large quantities of constant data Date: 13 Dec 2004 13:48:49 -0800 Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 80.176.143.194 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1102974529 16242 127.0.0.1 (13 Dec 2004 21:48:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 13 Dec 2004 21:48:49 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:6927 Date: 2004-12-13T13:48:49-08:00 List-Id: I want to set up about 100 variables which somehow reference variable-length arrays of other things. The other things, for a given variable, are fixed. Simplifying: type component is record X : character; end record; type component_list is array (positive range <>) of component; type component_ref is access all component_list; type structure is record part : component_ref; end record; So I will have lots of structures scattered about, which will be completely constant. I would like to enforce this constancy, but Ada (as far as I know) does not (unlike C++; that should get some hackles rising) allow `constant' to be splashed about in type definitions. This is on GNAT, which does not support pragma read_only. Is there any way to ensure that these data are not modified, other than by forbidding direct access to structure.part etc?