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.6 required=5.0 tests=BAYES_05,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!DDN-WMS.ARPA!thoyt From: thoyt@DDN-WMS.ARPA (Thomas Hoyt) Newsgroups: comp.lang.ada Subject: Variable Length Strings... Message-ID: <8906021617.AA11927@ajpo.sei.cmu.edu> Date: 2 Jun 89 16:19:40 GMT Sender: usenet@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: In Issue #143, Jonathon B. Owen writes... >... >Baring the above in mind, I don't understand why the generic parameter >Max_len should not be considered constant for the issue of determining >the max. size. After all, it's value is avaliable during elaboration >time, and of course cannot change, there after. >From what I understand of your problem, it *is* a constant, just a constant that is too big for the compiler to handle. Max_Len is declared: generic Max_Len : Integer; Package (etc)... The string range statement thus defines the variable length string to be anywhere from 0 to Integer'Last. This raises the possiblity that Integer'Last length strings could be created on the fly. This frightening implication causes the anxiety from the compiler. Try this in your original generic. Put some constaints on the generic parameter: generic Max_Len : Integer range 0..20000 := 20000; Package (etc)... This does two things. It allows for a default max variable string length if you choose to pass in nothing for the parameter. It also tells the compiler that at most there will be 20000 char length strings created dynamically. This is a whole lot less than Integer'Last( normally around 2^32 or there abouts ) and will calm Verdix's nerves. Of course, you can adjust the constants accordingly. Also there may be implimentation limits on how big you can define dynamic objects at one time. As always, check your manuals. This ought to permit you to keep the generic solution, i.e. without hard coding string range limits into separate packages. (*Disclaimer* I do not *sigh* have access to a Verdix compiler...as always, if this patch should fail, the secretary will disavow all knowledge...etc...) ****** thoyt@ddn-wms.arpa | "Oh no...it's written in COBOL..." Thomas Hoyt | "Government Computers for Government business..." CRC Systems, Inc., Fairfax, VA -- 703-359-9400 | "NO FUN ALLOWED..." ******