comp.lang.ada
 help / color / mirror / Atom feed
* Convention Question related to access types
@ 2019-06-07  1:51 Jere
  2019-06-08  5:11 ` Randy Brukardt
  0 siblings, 1 reply; 2+ messages in thread
From: Jere @ 2019-06-07  1:51 UTC (permalink / raw)


The RM in section B.1 talks about Ada Standard requirements for
convention compatibility.  In it however it doesn't mention anything
about private types, full views, etc.

Say you are wanting to bind to an opaque type in C:

   package Bindings is
      type Opaque_Type(<>) is limited private;
      type Binding is access Opaque_Type with Convention => C;

      procedure Some_Procedure(Value : Binding) with Import, Convention => C;

   private

      type Opaque_Base is limited null record with Convention => C;
      type Opaque_Type is new Opaque_Base;

   end Bindings;

GNAT happily accepts that, but I am unsure if that is because
of the "The implementation permits T as an L-compatible type." 
part or because Opaque_Base is a proper convention compatible
type and Opaque_Type derives from it and is thus convention
compatible as well, even though it is a private type.  

I couldn't find anything dictating whether the convention 
compatibility rules applied the to full view or the public
view.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Convention Question related to access types
  2019-06-07  1:51 Convention Question related to access types Jere
@ 2019-06-08  5:11 ` Randy Brukardt
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Brukardt @ 2019-06-08  5:11 UTC (permalink / raw)


"Jere" <jhb.chat@gmail.com> wrote in message 
news:15a1e593-42f5-4f80-a84c-c5b6d3f1ef7b@googlegroups.com...
> The RM in section B.1 talks about Ada Standard requirements for
> convention compatibility.  In it however it doesn't mention anything
> about private types, full views, etc.

Conventions apply to *entities*. See 6.3.1(2/1): "a convention can be 
specified for an entity". Views like a partial view is *of* an entity, not 
an entity itself. Thus there is only a single convention for a type. Where 
it is specified doesn't matter outside of Legality Rules. Thus the rules in 
B.1 only need to talk about types, not views.

I just had this argument about "entity" with other ARG members vis-a-vis a 
different topic (I lost :-), so I'm very certain this is correct.

                          Randy. 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-08  5:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07  1:51 Convention Question related to access types Jere
2019-06-08  5:11 ` Randy Brukardt

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