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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc87a0d17d684f50 X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Help with gnat storage error Date: 1997/06/24 Message-ID: <33AFFD4A.2E6E@gsfc.nasa.gov>#1/1 X-Deja-AN: 252270932 References: <5olggu$dcg$1@cdserv.rzg.mpg.de> Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Reply-To: Stephen.Leake@gsfc.nasa.gov Newsgroups: comp.lang.ada Date: 1997-06-24T00:00:00+00:00 List-Id: Myriam Witt wrote: > I'm using gnat's binary distribution > gnat-3.09-sparc-sun-solaris2.4-bin.tar.gz > on a SUN Ultra 2, Solaris 2.5.1 (anyone knows about a 2.5.1 binary?). > > During compile-/linktime I get some messages > 'warning: creation of object of this type may raise Storage_Error' > from code like > --- > type T_Polygon_XYZ (Max_Punkte: Natural := 1) is > record > Punkte : Natural := Max_Punkte; -- Anzahl der Polygonpunkte > X : T_Vector_Float(1..Max_Punkte) := (others => 0.0); > Y : T_Vector_Float(1..Max_Punkte) := (others => 0.0); > Z : T_Vector_Float(1..Max_Punkte) := (others => 0.0); > end record; > > where > > type T_Vector_Float is array(integer range <>) of Float; This is because you might declare: A : T_Polygon_XYZ (Natural'last); which would use all of memory (or at least a lot of it!). You should use a smaller range for Max_Punkte: type Max_Punkte_Type is range 1 .. 1000; type T_Polygon_XYZ (Max_Punkte: Max_Punkte_Type := 1) is You have to pick a reasonable max value, but that is usually not hard. If you really can not pick a max value, you should be using dynamic allocation, and a linked list or other structure instead of an array. -- - Stephe