comp.lang.ada
 help / color / mirror / Atom feed
From: thoyt@DDN-WMS.ARPA (Thomas Hoyt)
Subject: Variable length strings...
Date: 30 May 89 15:39:18 GMT	[thread overview]
Message-ID: <8905302008.AA07776@ajpo.sei.cmu.edu> (raw)

In issue #142, D. Papay is right on the $$$ with his comments on variable
length strings.  However...

>...I suggest you remove the default expression " := 0" from your
> record type ... and always declare ... with explicit discriminant
> contraints...

If you do this, you lose all the advantages of a parameterized record,
i.e. variable length strings.  Why not constrain the subtype of the
range of the record parameter:
^^^^^
   subtype Len_range is integer range 0..256; -- or some other max
                                              -- string length

This way the compiler would know exactly how big the strings could ever
get and plan accordingly...i.e. stop complaining.

Of course, you could still have pretty huge strings without coming close to
whatever Integer'Last is.  Another advantage is that the writer of the
generic could explicitly control how big the variable length strings
could ever get, without having to rely upon implimentation details. 

You also eliminate a generic parameter, relieving the user of an unnecessary
detail.  Most text editing functions wouldn't ever need more than about
1024 chars at a time (need...hope?:-))
 

******
Thomas Hoyt             |  "Government Computers for Government business..."
CRC Systems, Inc.       |  "NO FUN ALLOWED..."
thoyt@ddn-wms.arpa		|	"Oh no...it's written in COBOL..."
******

             reply	other threads:[~1989-05-30 15:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-05-30 15:39 Thomas Hoyt [this message]
  -- strict thread matches above, loose matches on Subject: below --
1989-06-02 13:26 Variable Length Strings "Jonathan B. Owen"
1989-06-06 13:19 ` Paul Warren
1989-06-02 16:19 Thomas Hoyt
1989-06-04  7:03 Variable Length strings "Jonathan B. Owen"
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
replies disabled

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