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,FREEMAIL_FROM autolearn=unavailable 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: Victor Porton Newsgroups: comp.lang.ada Subject: Re: 'Size hack for enumerated types Date: Tue, 08 Jul 2014 16:52:23 +0300 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: BISA/P8IHJbAM3ms471zeQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.12.4 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:20800 Date: 2014-07-08T16:52:23+03:00 List-Id: AdaMagica wrote: > On Monday, July 7, 2014 10:23:06 PM UTC+2, Victor Porton wrote: >> Simon Wright wrote: >> > Victor Porton writes: >> >> Where in the Reference Manual it is said that Ada enumeration types >> >> are "equivalent" to C int (=enum) type? >> > Annex B.1 (http://www.ada-auth.org/standards/12rm/html/RM-B-1.html), >> > 2 The Convention aspect is used to indicate that an Ada entity should >> > use the conventions of another language. >> > 21 If the Convention aspect is specified for a type, then the type >> > shall >> > either be compatible with or eligible for the specified convention. >> No reason to assume either of: >> 1. Ada enumeration is compatible with C int/enum. >> 2. Ada enumeration is eligible for the specified convention (the >> convention C). >> This is a work for a future standard. >> It seems that the current one does not assert neither 1 neither 2. :-( > > B.1(21/3) says "shall", so RM 1.1.5(3) applies. The compiler must reject > the code if the enumeration is not compatible with C. It could be able to meaningfully reject the code, only it knew the C function profile. But what it known about the C function profile is only what is provided in our pragma. Certainly the C function profile which we provide is compatible with itself :-) So, the C code is compatible with some Ada function profile, but not necessarily with one we provide. Just logic. > B.1(2/3) only says "should". So what does this mean? I gather together > with (21), we're safe to assume it works. -- Victor Porton - http://portonvictor.org