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,dcfafdc50abb8ce4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-07 14:45:02 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: records containing variable length arrays [long] Date: 07 Jun 2001 17:38:27 -0400 Organization: NASA Goddard Space Flight Center Message-ID: References: <3B1E8BB9.42BF95D2@mida.se> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 991950870 24019 128.183.220.71 (7 Jun 2001 21:54:30 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 7 Jun 2001 21:54:30 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.6 Xref: archiver1.google.com comp.lang.ada:8355 Date: 2001-06-07T21:54:30+00:00 List-Id: Mats Karlssohn writes: > I'm currently wrestling with an interesting problem. I feel that this > have probably been discussed previously, but I couldn't find anything > on it neither on AdaPower nor on the cla. archives on google. > > I would like to declare a record type containing two (possibly more) > arrays of variable lengths, the length of each array is another element > of the record. I also need to specify an exact representation for the > record since it is a message that I cant change the format of. > > Do you really need to declare the message as a single type? That is, do you really need to pass objects of that type around? Or can you get by with reading the message from a stream, and building a set of internal objects that other packages access in a controlled way? The point being that there are many reasonable communications protocols that simply cannot be expressed as an Ada record, and this seems to be one of them. The correct approach is to encode the protocol as a procedure that reads from a stream, not as an Ada record type. -- -- Stephe