comp.lang.ada
 help / color / mirror / Atom feed
From: Anonymous Coward <bogus_addy@bogus_domain.net>
Subject: Re: pragma convention
Date: Sun, 06 Nov 2005 22:22:18 GMT
Date: 2005-11-06T22:22:18+00:00	[thread overview]
Message-ID: <slrndmt7hp.6kb.bogus_addy@tango.mindfuq.org> (raw)
In-Reply-To: cHcbf.204$c_1.175@newsread3.news.pas.earthlink.net

In article <cHcbf.204$c_1.175@newsread3.news.pas.earthlink.net>, 
Jeffrey R. Carter wrote:
> 
> pragma Convention (X, ...
> 
> really means the convention used by some specific X compiler chosen
> by the Ada compiler developers for those cases where the X language
> does not rigorously specify the characteristic in question.

I find it interesting that pragma Convention even appears in the ARM,
considering there is no definite behavior required for it.  It seems
it would be more appropriate to not even mention it in the ARM, and
let the compiler implementors decide whether to have it.  Or if pragma
Convention should be mentioned in the ARM, it should be rewritten.  I
would rewrite this:

   ARM B.1.21

   If pragma Convention applies to a type, then the type shall either
   be compatible with or eligible for the convention specified in the
   pragma.

to state something like:

   If pragma Convention applies to a type, then the type shall be
   compatible with conventions specified in the pragma for languages
   that have a convention.  For other languages, pragma Convention is
   to be offered at the discretion of the compiler authors.

From there, it would be useful to have a list of languages that have
default representations, so ADA programmers know when they can expect
some precise behavior from pragma convention.

> Convention C does do certain common things for you. For an access
> type, you insure that it is just a pointer, and doesn't contain any
> additional data (which Ada's access values can and sometimes do
> contain). 

That's useful to know.. but why doesn't the ARM lay down the rule on
that?  It seems largely like guesswork to know what to expect from
pragma convention.

Is there a way to explicitly define a pointer in ADA to be a raw
address as it is for C, without the pragma convention?  Is that what
system.address is?  

> For subprograms, you get automatic conversion of parameters to
> pointers to match C passing rules and make [in] out parameters work
> properly.
> 
> This latter is very useful; you can write
> 
> procedure C (X : out Interfaces.C.Int);
> pragma Import (C, X, "xInC");
> 
> and the compiler takes care of passing a pointer for you.

Parameter modes are handled entirely by pragma import, correct?  I'm
not sure what pragma convention does in that respect.

Someone stated earlier that pragma convention will ensure order is
preserved for records types passed to pragma convention, but the GNAT
manual states that pragma Convention has no effect on records:

http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gnat_rm/Effect-of-Convention-on-Representation.html

I find it frustrating to work with loosely defined characteristics in
ADA.  At this point, I'll continue to use pragma convention for the
heck of it, but ultimately it seems I cannot solely rely on it to do
anything, and I should be rep specing records and enum sizes anyway.



  reply	other threads:[~2005-11-06 22:22 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04  2:21 Default rep specs for record types - documented?? Anonymous Coward
2005-11-04  2:36 ` Steve
2005-11-04  4:11   ` Anonymous Coward
2005-11-04  5:30     ` Jeffrey R. Carter
2005-11-05  3:13       ` Steve
2005-11-05  4:45         ` Jeffrey R. Carter
2005-11-06 14:05           ` Steve
2005-11-06 16:08             ` Anonymous Coward
2005-11-07  7:25             ` Jeffrey R. Carter
2005-11-08 13:36               ` Steve
2005-11-14  1:12             ` Robert A Duff
2005-11-14  3:03               ` Anonymous Coward
2005-11-14 18:08                 ` Jeffrey R. Carter
2005-11-14 18:49                 ` Robert A Duff
2005-11-15  1:16                   ` ADA compilers can reject types arbitrarily? Anonymous Coward
2005-11-15  2:10                     ` tmoran
2005-11-15  3:12                     ` Robert A Duff
2005-11-15  6:44                     ` Simon Wright
2005-11-16  0:16                       ` Adaists Deny Acronym. (was: ADA compilers can reject types arbitrarily?) Björn Persson
2005-11-16  5:38                         ` Adaists Deny Acronym Simon Wright
2005-11-16  6:16                         ` Adaists Deny Acronym. (was: ADA compilers can reject types arbitrarily?) Samuel Tardieu
2005-11-15 12:43                     ` ADA compilers can reject types arbitrarily? Jeff Creem
2005-11-14 21:14                 ` Default rep specs for record types - documented?? Simon Wright
2005-11-04 13:26     ` Stephen Leake
2005-11-04 14:33       ` Marc A. Criley
2005-11-04 18:35         ` Georg Bauhaus
2005-11-04 20:07           ` Britt Snodgrass
2005-11-04 14:39       ` Stephen Leake
2005-11-04 15:27         ` Britt Snodgrass
2005-11-04 15:55           ` Lauri Ora
2005-11-04 21:42             ` Larry Kilgallen
2005-11-05  2:26             ` Anonymous Coward
2005-11-05  2:42               ` Frank J. Lhota
2005-11-05  3:27               ` Ed Falis
2005-11-05  3:55                 ` Anonymous Coward
2005-11-05  4:07                 ` Lauri Ora
2005-11-05 13:46                   ` Ed Falis
2005-11-05 10:14                 ` Stephen Leake
2005-11-04 16:52         ` Frank J. Lhota
2005-11-04 16:57           ` Frank J. Lhota
2005-11-04 23:27           ` tmoran
2005-11-05 10:25           ` Stephen Leake
2005-11-14  1:09             ` Robert A Duff
2005-11-05  3:33       ` Anonymous Coward
2005-11-05 10:34         ` Stephen Leake
2005-11-05 16:35           ` ADA/C interfaces: type representations uncontrollable in C Anonymous Coward
2005-11-05 16:49             ` Ed Falis
2005-11-05 18:24             ` tmoran
2005-11-09  2:12           ` 'Size can mean value size OR object size, depending Anonymous Coward
2005-11-09  3:27             ` Jeffrey R. Carter
2005-11-09  4:04               ` Anonymous Coward
2005-11-05 14:27         ` Default rep specs for record types - documented?? Michael Bode
2005-11-05 16:17           ` pragma convention Anonymous Coward
2005-11-06  1:07             ` Jeffrey R. Carter
2005-11-06 22:22               ` Anonymous Coward [this message]
2005-11-07  7:34                 ` Jeffrey R. Carter
2005-11-05 14:39         ` Default rep specs for record types - documented?? Martin Krischik
2005-11-04  9:40   ` Martin Dowie
2005-11-04 14:36   ` Marc A. Criley
2005-11-04 17:45 ` Martin Krischik
replies disabled

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