comp.lang.ada
 help / color / mirror / Atom feed
From: mfeldman@seas.gwu.edu (Michael Feldman)
Subject: Re: generic queue packages
Date: Sun, 28 Feb 1993 05:31:47 GMT
Date: 1993-02-28T05:31:47+00:00	[thread overview]
Message-ID: <1993Feb28.053147.8686@seas.gwu.edu> (raw)
In-Reply-To: 1mp0h3INNp2u@huon.itd.adelaide.edu.au

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 :-)



  reply	other threads:[~1993-02-28  5:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-02-24 21:26 generic queue packages John Goodsen
1993-02-26  3:16 ` enterpoop.mit.edu!spool.mu.edu!howland.reston.ans.net!zaphod.mps.ohio-sta
1993-02-26 19:02   ` Michael Feldman
1993-02-28  0:20     ` Andrew Dunstan
1993-02-28  5:31       ` Michael Feldman [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-02-22 15:32 pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!nntpd2.cxo.dec.com!etre!w
1993-02-09 19:04 cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!h
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox