comp.lang.ada
 help / color / mirror / Atom feed
From: ftpbox!mothost!motcid!bachww@uunet.uu.net  (Bud Bach)
Subject: Re: Is this legal ?
Date: 9 Nov 91 18:02:59 GMT	[thread overview]
Message-ID: <5637@melon37.UUCP> (raw)

pelakh@convex.com (Boris Pelakh) writes:

> Blah, Blah, Blah...

>procedure BROKE is
>   type VAR_LINE(LENGTH : INTEGER := 10) is
>      record
>             IMAGE : STRING(1..LENGTH);
>      end record;
>   NULL_LINE : VAR_LINE;
>begin
>    null;
>end BROKE;

This is sort of a FAQ.

It has been fairly common for implementations to allocate the maximum
possible space in this situation.

Is it possible that you could constrain the length to something smaller
than "Integer"?

    procedure Common_Problem is

      subtype Reasonable_Length is Integer range 1..255;

      type Var_Line (Length : Reasonable_Length := 10) is
	record
	  Image : String (1 .. Length);
	end record;

    begin
      null;
    end Common_Problem;

Of course, knowing that the compiler will allocate "Reasonable_Length"
characters for each object of type "Var_Line", you might want to choose a
different representation.  Representations for strings always seem highly
application dependent.  There has been some recent discussion about string
representations in comp.compilers that you may want to reference.

Good luck,  -- Bud



-- 
Bud Bach - Consultant				c/o Motorola
708 632-3449					Cellular Infrastructure Group
...!uunet!motcid!bachww or			1501 W. Shure Drive, MS-1235
bachww%motcid@uunet.uu.net			Arlington Heights, IL  60004

             reply	other threads:[~1991-11-09 18:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-11-09 18:02 Bud Bach [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-16 19:00 Is this legal? Simon Belmont
2021-10-17  8:35 ` Gautier write-only address
2021-10-17  8:41 ` AdaMagica
2021-10-17 18:31   ` Simon Belmont
2021-10-18 10:50     ` AdaMagica
2021-10-19  3:50 ` Randy Brukardt
1991-11-09  3:20 Is this legal ? Robert I. Eachus
1991-11-08 20:58 Boris Pelakh
replies disabled

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