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=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: 'Size hack for enumerated types Date: Tue, 08 Jul 2014 08:04:06 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="5cbec41b82bafb9ba55107f02585e18b"; logging-data="18782"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qwVeld+rwaZWR6u+5lVMJA5Vww8DmhdY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:9+SHknBsJv1NIJt4FLCfzxJ+TYg= sha1:kC3Is2MsayymlIfipeI7uQfX0aA= Xref: number.nntp.dca.giganews.com comp.lang.ada:187443 Date: 2014-07-08T08:04:06+01:00 List-Id: Victor Porton writes: > 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. :-( Well, try submitting it to the ARG. I expect you'll get rebuffed in short order. I tried type Flag_Type is (Libxml_Error_Save, Libxml_Structured_Error_Save, URI_Interning, WWW_Skip_Init_Finish) with Size => 3, Convention => C; and GNAT said "warning: C enum types have the size of a C int" (I had hoped this would have been an error, not a warning).