comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: 'Size hack for enumerated types
Date: Tue, 08 Jul 2014 16:52:23 +0300
Date: 2014-07-08T16:52:23+03:00	[thread overview]
Message-ID: <lpgt2s$893$1@speranza.aioe.org> (raw)
In-Reply-To: cc07cecd-97c7-45f3-9774-f75663bc105d@googlegroups.com

AdaMagica wrote:

> On Monday, July 7, 2014 10:23:06 PM UTC+2, Victor Porton wrote:
>> Simon Wright wrote:
>> > Victor Porton <porton@narod.ru> 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

  reply	other threads:[~2014-07-08 13:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05 20:32 'Size hack for enumerated types Victor Porton
2014-07-05 21:47 ` Simon Wright
2014-07-05 22:11   ` Victor Porton
2014-07-05 22:18     ` Victor Porton
2014-07-05 22:23       ` Victor Porton
2014-07-06 16:25         ` Victor Porton
2014-07-06 20:59       ` Simon Wright
2014-07-06 23:01         ` Victor Porton
2014-07-06 23:30           ` Jeffrey Carter
2014-07-07 16:00             ` Victor Porton
2014-07-07 17:12               ` Simon Wright
2014-07-07 20:23                 ` Victor Porton
2014-07-08  7:04                   ` Simon Wright
2014-07-08 10:17                     ` sbelmont700
2014-07-08 14:53                     ` Dan'l Miller
2014-07-08 20:56                       ` Randy Brukardt
2014-07-08 22:26                         ` Dan'l Miller
2014-07-08 23:18                         ` Jeffrey Carter
2014-07-08  9:43                   ` AdaMagica
2014-07-08 13:52                     ` Victor Porton [this message]
2014-07-08 15:02                       ` Simon Wright
2014-07-07  7:45           ` Simon Wright
2014-07-06  7:22     ` Simon Wright
2014-07-06 13:21 ` sbelmont700
2014-07-06 16:16   ` Victor Porton
2014-07-06 17:52     ` sbelmont700
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox