comp.lang.ada
 help / color / mirror / Atom feed
From: GDAU100@BGUVM.BITNET ("Jonathan B. Owen")
Subject: Variable Length strings...
Date: 4 Jun 89 07:03:21 GMT	[thread overview]
Message-ID: <8906031720.AA05393@ajpo.sei.cmu.edu> (raw)

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.
______________________________________________________________________________

             reply	other threads:[~1989-06-04  7:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-06-04  7:03 "Jonathan B. Owen" [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-10-21 17:52 variable lenght strings fabio de francesco
2004-10-22  7:25 ` Martin Krischik
2004-10-22 11:11   ` Martin Dowie
2004-10-24 15:43     ` Martin Krischik
2004-10-24 18:37       ` Björn Persson
2004-10-25  7:30         ` Martin Krischik
2004-10-26  0:06           ` Randy Brukardt
2004-10-26  8:43             ` Jean-Pierre Rosen
2004-10-26 13:15               ` Martin Krischik
2004-10-26 17:37                 ` Pascal Obry
2004-10-26 18:07                   ` Hyman Rosen
2004-10-26 20:10                     ` Pascal Obry
2004-10-27 10:26                       ` variable length strings Jacob Sparre Andersen
2004-10-27 10:39                         ` Pascal Obry
2004-10-27 11:47                         ` Larry Kilgallen
2004-10-28  7:18                           ` Jacob Sparre Andersen
2004-10-27 11:50                         ` Larry Kilgallen
     [not found]                         ` <uwtxcla1n.fsf@obry.Organization: LJK Software <PTzuwe3GsIg6@eisner.encompasserve.org>
2004-10-27 12:12                           ` Samuel Tardieu
2004-10-27 12:58                             ` Pascal Obry
2004-10-27 13:04                           ` Pascal Obry
2004-10-27 14:54                             ` Dmitry A. Kazakov
2004-10-27 16:38                               ` Pascal Obry
2004-10-28  8:14                                 ` Dmitry A. Kazakov
2004-10-28  8:49                                   ` Pascal Obry
2004-10-28  9:06                                     ` Dmitry A. Kazakov
2004-10-28 16:07                                       ` Pascal Obry
2004-10-28 22:05                                         ` Jeffrey Carter
2004-10-28 22:41                                           ` Randy Brukardt
2004-10-29  1:11                                             ` Jeffrey Carter
2004-10-29  7:42                                         ` Dmitry A. Kazakov
2004-10-28 10:31                         ` Larry Kilgallen
2004-10-26 11:18             ` variable lenght strings Marius Amado Alves
2004-10-26 12:48               ` variable length strings Larry Kilgallen
2004-10-26 16:11                 ` Warren W. Gay VE3WWG
2004-10-26 18:50                   ` Björn Persson
2004-10-26 19:46                     ` Larry Kilgallen
1989-06-02 16:19 Variable Length Strings Thomas Hoyt
1989-06-02 13:26 "Jonathan B. Owen"
1989-06-06 13:19 ` Paul Warren
1989-05-30 15:39 Variable length strings Thomas Hoyt
replies disabled

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