comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Access and alias
Date: 2000/04/07
Date: 2000-04-07T00:00:00+00:00	[thread overview]
Message-ID: <K5rH4.445$uE2.158283@news.pacbell.net> (raw)
In-Reply-To: 8ckeup$9ed$1@nnrp1.deja.com

>If the compiler DID use a different representation for the
>two, I would say your prescription would be quite wrong, there
>is absolutely no requirement in the RM for such conversions,
>and pragmatically it would be a bad idea to molest parameters
>in this way.

So the effect of a pragma import on a function's parameters
should not be to generate any code, but merely to check that the
parameters' types are "compatible" between the external language
and the Ada compiler?  For

  type Matrix is array(1 .. 10, 1 .. 5) of float;
  type pconstrained is access matrix;
  type List is array(integer range <>) of float;
  type punconstrained is access List;

  function cf(a : pconstrained; b : punconstrained) return float;
  pragma import(C, cf);

Gnat 3.12p NT does indeed generate a nice diagnostic
"type of cf.b does not correspond to C pointer".

But it gives no warning for

  function Trace(M : in Matrix) return float;
  pragma import(Fortran, Trace);

where of course Matrix is stored in one way in Ada and another
in Fortran.  Is this disparity just B.1(20)'s "The implementation
permits T as an L-compatible type" with Gnat permitting
Matrix but not punconstrained?

The other part of the post was:
>Is there also a requirement that it convert its idea of a
>System.Address into the called language's idea of an access value?

So the compiler should not convert System.Address to char *p,
but may either permit it or flag it as it sees fit,  with no
required relationship to whether their memory representations
match?




  reply	other threads:[~2000-04-07  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-04  0:00 Access and alias NANCY HEHIR
2000-04-04  0:00 ` Laurent Guerby
2000-04-04  0:00   ` NANCY HEHIR
2000-04-04  0:00     ` Laurent Guerby
2000-04-05  0:00       ` Alfred Hilscher
2000-04-05  0:00         ` Ted Dennison
2000-04-05  0:00           ` Jeff Carter
2000-04-06  0:00             ` Robert Dewar
2000-04-07  0:00               ` Jeff Carter
2000-04-06  0:00             ` Alfred Hilscher
2000-04-07  0:00               ` Jeff Carter
2000-04-06  0:00           ` tmoran
2000-04-07  0:00             ` Robert Dewar
2000-04-07  0:00               ` tmoran [this message]
2000-04-09  0:00                 ` Robert Dewar
2000-04-09  0:00                   ` tmoran
2000-04-10  0:00                 ` Jack W. Sharer
2000-04-06  0:00           ` Robert Dewar
2000-04-05  0:00         ` Laurent Guerby
2000-04-05  0:00     ` Jeffrey D. Cherry
2000-04-04  0:00 ` tmoran
replies disabled

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