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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: Warning: Storage error Date: Sat, 9 Aug 2014 16:07:09 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: Reply-To: anon@att.net NNTP-Posting-Host: DCQtgbqtn94CO6691IAXVg.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: IBM NewsReader/2 2.0 Xref: news.eternal-september.org comp.lang.ada:21609 Date: 2014-08-09T16:07:09+00:00 List-Id: Using n normally defined integer with the bounds set to - 2GB .. 2GB, this type of unbound record size can range from 0 to 2GB. All though today, most systems have 8 to 64 GB of main memory and up to 256 TB ( 2 ** 64 ) of virtual storage the Ada compiler does not know at compile time, the total run-time system memory or how much memory may be allocated to your program. To correct this add a discriminant type or subtype -- Same size as just using "Integer' but compiler does not -- generate the storage warnings subtype D_Integer is Integer range 0 .. Integer ' Last ; type My_String ( Length : D_Integer := 0 ) is record Str: String ( 1 .. Length ) ; end record ; You could say that GNAT is being overly touchy on some standard statements when using predefined types such as "Integer" or types that could cause a problem. In , Victor Porton writes: > type My_String (Length: Integer := 0) is > record > Str: String(1..Length); > end record; > >warning: creation of "My_String" object may raise Storage_Error > >Why this warning? > >-- >Victor Porton - http://portonvictor.org