comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Discrimant Record Types and GNAT
Date: 1999/01/12
Date: 1999-01-12T00:00:00+00:00	[thread overview]
Message-ID: <m3hftxfe41.fsf@mheaney.ni.net> (raw)
In-Reply-To: 369A84AB.CD5B5A4D@nordnet.fr

You have use a smaller maximum size.  For example:

  subtype Length_Range is Natural range 0 .. 80;

  type Name_Buffer (Length : Length_Range := 0) is
    record
      Name : String (1 .. Length);
    end record;



abailly <abailly@nordnet.fr> writes:

> I've got problems with using discrimant record types with defaults
> values
> For example :
> 
> type Tab is array(POSITIVE range <>) of TOTO;
> type REc (taille : NATURAL := 0) is record
>     t : tab(1..taille);
> end record;
> 
> I've been taught by my Ada teacher that this kind of object could be
> declared as
> tab1 : Rec;
> and then used with tab1 := <any_rec>
> effectively creating an unconstrained array.
> 
> However, when I compile something like that with GNAT (3.10p on a
> Linux-i586 box)
> I get warnings at compile time and STORAGE_ERROR at runtime, which is
> not the case
> with another compiler we are using for lessons.
> 
> Anyone got an answer to this problem ?
> 
> Thank you in advance
> 
> Arnaud BAILLY




  reply	other threads:[~1999-01-12  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-11  0:00 Discrimant Record Types and GNAT abailly
1999-01-12  0:00 ` Matthew Heaney [this message]
1999-01-12  0:00 ` Samuel Tardieu
replies disabled

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