comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@rfc1149.net>
Subject: pragma Convention questions
Date: Sun, 11 Nov 2007 17:39:59 +0100
Date: 2007-11-11T17:40:12+01:00	[thread overview]
Message-ID: <87sl3cd9cw.fsf@willow.rfc1149.net> (raw)

I have several questions regarding pragma Convention in Ada95 for
language lawyers.

1- pragma Convention on private types in language-define packages

Is it allowed for a compiler implementor to use a pragma Convention
on a private type in a language-defined package?

For example, would it be allowed to use

  pragma Convention (C, chars_ptr);

in the private part of Interfaces.C.Strings? (the real motive to this
question is to get rid of a warning in GNAT about conversion between
pointers of different conventions -- the type is already compatible
with C as per RM B3.1(1))

2- pragma Convention, renaming and Intrinsic

Is the following code legal?

package U is
   type Foo is (Foo1, Foo2);
   function F return Foo renames Foo1;
   pragma Convention (Ada, F);
   type Foo_Access is access function return Foo;
   X : Foo_Access := F'Access;
end U;

GNAT rejects X initialization with 'prefix of "Access" attribute
cannot be intrinsic'. Which means that the pragma Convention failed
silently. Is it allowed to have it fail without a compilation error?
Or is the 'Access legal?

  Sam
-- 
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/



             reply	other threads:[~2007-11-11 16:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-11 16:39 Samuel Tardieu [this message]
2007-11-11 19:14 ` pragma Convention questions Martin Krischik
2007-11-11 20:57   ` Samuel Tardieu
2007-11-12  8:14     ` Martin Krischik
2007-11-12  8:30       ` Samuel Tardieu
2007-11-12 17:02 ` Adam Beneschan
2007-11-12 21:54   ` Samuel Tardieu
2007-11-15  5:06 ` Randy Brukardt
2007-11-15  7:55   ` Samuel Tardieu
replies disabled

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