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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!BGUVM.BITNET!GDAU100 From: GDAU100@BGUVM.BITNET ("Jonathan B. Owen") Newsgroups: comp.lang.ada Subject: Variable Length strings... Message-ID: <8906031720.AA05393@ajpo.sei.cmu.edu> Date: 4 Jun 89 07:03:21 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet X-Unparsable-Date: Sat, 03 Jun 89 20:05:44 IST List-Id: Thomas Hoyt writes that having the following: generic Max_len : Integer; package VSTR is subtype Len_range is integer range 0..Max_len; etc... DOES imply a maximum length for a discriminant of type Len_range, be it integer'LAST. Also, he suggests using a fixed upper limit to Max_len, say 20000. First, as far as I observed, on Vax Ada, the actuall value for Max_len for a particular instantiation is taken as the upper limit for a disc. of type Len_range. I see no reason why Verdix Ada should not do it. Secondly, I do believe defining the range of Max_len to be limited to 20000. Still, I think it would be unreasonable to allocate 20K for each V_string defined, when typicalalues for Max_len would be much smaller (say 15, 80 and such). It seems to me Verdix Ada handles Dynamically defined types/Subtypes differently than the Vax Ada. Come to think of it, I ran into a related problem as the above, in a non-generic package. Consider the following: type Record_header is record key : Key_type; time : Time_type; end record; Max_data_len : constant integer := 2048-Record_header'SIZE/8; subtype Data_len_range is integer range 0..Max_data_len; type Record_type( data_len : Data_len_range := 0 ) is record header : Record_header; data : String(1..data_len); end record; Say the Record_header occupies 48 bytes. The purpose of the above is to define a record which would occupy 2K at the most, including the header. The above works find on Vax-Ada but fails on Verdix with the same problem of not recognizing the upper limit of Data_len_range. I hope the shortcoming of Verix is now obvious... Jonathan ______________________________________________________________________________ (--) /--) /-(\ Email: gdau100@bguvm (bitnet) \ / /--K | \|/\ /\/) /|-\ Snail: 55 Hovevei Zion _/_/o /L__)_/o \/\__/ \X/ \_/ | |_/ Tel-Aviv, 63346 ISRAEL (/ Jonathan B. Owen Voice: (03) 281-422 Point of view: A chicken is the means by which an egg reproduces an egg. ______________________________________________________________________________