From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f7f7e25c656d4fca X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Discrimant Record Types and GNAT Date: 1999/01/12 Message-ID: #1/1 X-Deja-AN: 431474423 Sender: matt@mheaney.ni.net References: <369A84AB.CD5B5A4D@nordnet.fr> NNTP-Posting-Date: Mon, 11 Jan 1999 17:54:44 PDT Newsgroups: comp.lang.ada Date: 1999-01-12T00:00:00+00:00 List-Id: 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 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 := > 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