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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8a34575d5eb275cb X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!newsfeed-fusi2.netcologne.de!195.14.215.230.MISMATCH!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 03 Apr 2009 18:08:13 +0200 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Load an object from a file References: <49d5fa88$0$2862$ba620e4c@news.skynet.be> <443d72ca-5bbd-46a3-84c6-e8bd984e5b80@k41g2000yqh.googlegroups.com> <49d628f5$0$2865$ba620e4c@news.skynet.be> In-Reply-To: <49d628f5$0$2865$ba620e4c@news.skynet.be> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <49d6346e$0$32681$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 03 Apr 2009 18:08:14 CEST NNTP-Posting-Host: 9ddf2ecc.newsspool2.arcor-online.net X-Trace: DXC=:6IlARc]nCYf8j24CD<3lPA9EHlD;3YcR4Fo<]lROoRQ^YC2XCjHcbY>EHjJZ1ZB_R;9OJDO8_SKVNSZ1n^B98iZkne\2RV\dcV X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:4423 Date: 2009-04-03T18:08:14+02:00 List-Id: Olivier Scalbert schrieb: > Thanks Ludovic, > > One more question: > > with: > type u2 is new Integer; > type cp_info is new Integer; > > type Constant_Pool_Array is array (Positive range <>) of cp_info; > type Interfaces_Array is array (Positive range <>) of u2; Make the index type the same as the type in the disciminant, that is, u2. type Constant_Pool_Array is array (u2 range <>) of cp_info; type Interfaces_Array is array (u2 range <>) of u2; since U2 is the type of the discriminants used in providing the array bounds. In fact, very likely the type U2 is range 0 .. Something, with Java's integer type semantics regarding overflow and wrap around. Perhaps it is a good idea to express this in Ada for U2 as well. > type Class_File > (constant_pool_count, > interfaces_count, > fields_count, > methods_count, > attributes_count : u2) > is record > constant_pool : Constant_Pool_Array (2 .. constant_pool_count); > interfaces : Interfaces_Array (1 .. interfaces_count); > end record; > > I have an error: expected type "Standard.Integer", in the 2 last lines. > If I replace the line: > "attributes_count : u2" by > "attributes_count : Integer" > then compile is Ok ! > Don't know how to cleanly solve ...