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 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5a817e6528505e97 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1993-02-27 21:31:47 PST Newsgroups: comp.lang.ada Path: sparky!uunet!think.com!ames!haven.umd.edu!darwin.sura.net!seas.gwu.edu!mfeldman From: mfeldman@seas.gwu.edu (Michael Feldman) Subject: Re: generic queue packages Message-ID: <1993Feb28.053147.8686@seas.gwu.edu> Sender: news@seas.gwu.edu Organization: George Washington University References: <1993Feb26.031650.3447@leeweyr.sccsi.com> <1993Feb26.190255.24811@seas.gwu.edu> <1mp0h3INNp2u@huon.itd.adelaide.edu.au> Date: Sun, 28 Feb 1993 05:31:47 GMT Date: 1993-02-28T05:31:47+00:00 List-Id: In article <1mp0h3INNp2u@huon.itd.adelaide.edu.au> andrewd@cs.adelaide.edu.au (Andrew Dunstan) writes: >In article <1993Feb26.190255.24811@seas.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes: > >A "realistic" maximum might still be quite large. Say we allow lines up >to 255 chrs. Storage of 100,000 lines of average length 10 will still >waste megabytes of memory if a static allocation strategy is used by the >compiler. Indeed. > >That is why I generally avoid this sort of use of variant records for >this sort of processing - if I want dynamic sizing I make it explicit >by doing it myself - that makes for portable code. It also means I >don't have to use arbitrary limits on the size of some structure. > I agree. The price we pay for having powerful structures - in our case variant records with unconstrained array objects as fields - is that we need to consider very carefully how to use them, if at all. If the field in question is a string, using a C-style dynamically allocated string, with the record containing a pointer thereto, probably allows one better to control the storage allocation. I'd probably carry a length field, though, instead of null-terminating the string C-style, to avoid linear searching to find the length. Is this what you had in mind, Andrew? Mike Feldman PS - it's really nice to discuss some technical issues for a change :-)