Re: Possible compiler bug with this simple program
- From: "Randy Brukardt" <randy@xxxxxxxxxxxxxx>
- Date: Fri, 29 Aug 2008 20:00:54 -0500
"Jerry" <lanceboyle@xxxxxxxxx> wrote in message
news:97b1150b-cb8f-4972-b594-2ae59af84147@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
....
FWIW, in the _real_ application that I am working on, plmap is written
in C (and accessed from my binding by an Import).
Interestingly, that's completely different. That *should* work on all Ada
compilers (note that the wording specifically excludes unconstrained
parameters for pragma Import).
This example program is unportable garbage, unfortunately, because of
AI05-0002-1, and also because of B.1(38.1/2) (the "buyer beware" clause:
there is no requirement that an Ada program actually work as expected if you
force its conventions to another language (like C).
Admittedly, this is a bit strange. In this case, C works fine as the
receiver of such a call because it has no need to know the bounds of the
array passed. (And if it does, they're going to be passed explicitly.) But
Ada does need to know those bounds, and you can't even pass them explicitly
because the Ada compiler will have to assume something for the lower bound
in order to generate indexing operations (and that may be different than
what you intended).
The net effect is that the example program doesn't prove anything useful. It
would need to import an actual C subprogram in order to be a useful test.
Randy.
.
- References:
- Possible compiler bug with this simple program
- From: Jerry
- Re: Possible compiler bug with this simple program
- From: Niklas Holsti
- Re: Possible compiler bug with this simple program
- From: Randy Brukardt
- Re: Possible compiler bug with this simple program
- From: Jerry
- Possible compiler bug with this simple program
- Prev by Date: Re: Possible compiler bug with this simple program
- Next by Date: Re: and then... (a curiosity)
- Previous by thread: Re: Possible compiler bug with this simple program
- Next by thread: Re: Possible compiler bug with this simple program
- Index(es):
Relevant Pages
|