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,f837a1a69cca0bea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-25 08:11:19 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: can a record contain an array whose bounds are not known at compi le time? User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Fri, 25 Oct 2002 15:10:49 GMT Content-Type: text/plain; charset=us-ascii References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:30136 Date: 2002-10-25T15:10:49+00:00 List-Id: "Yu, Liyang" writes: > I need to use an array in a record and this array's bound is not known at > compile time. Can Ada do this? Can someone give me a example about how to do > this or any reference that I can use? If the array always has the *same* bounds, then you just use those bounds (even if not compile-time known): subtype My_String is String(A..B); type T is record X: My_String; A and B can depend on input data, for example. If different records of the type have different-length arrays, but the length doesn't change once created, use a discriminant as suggested in another post. If the length of the arrays changes over time, you must simulate that using a pointer. - Bob