Re: Possible compiler bug with this simple program



"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.




.



Relevant Pages

  • Re: No call for Ada (was Re: Announcing new scripting/prototyping language)
    ... Speaking as one who does this daily in Ada, ... I've used and do use Ada compilers that are as ... > indication of a performance problem in the language proper. ... However, in most apps, the cost isn't so high as to be prohibitive. ...
    (comp.lang.ada)
  • Re: GNAT and GNU build system
    ... Ada programs. ... Luckily there are no other free software compilers for Ada95 than GNAT, ... so free software developers don't need to pay attention to this problem. ... So authors may have to pay attention to configuration ...
    (comp.lang.ada)
  • Re: += in ada
    ... > as inherently inefficient - backed up by poor quality compilers. ... > syntax changes is going to in any way win over the crowd that hated Ada ... proposed APSEs. ... "Quality is the Buddha. ...
    (comp.lang.ada)
  • Re: GNAT GPL 2005 Edition is now available
    ... I oppose Debian moving to any Ada compiler which generates ... code that has serious license restrictions. ... Why should GNAT be any different? ... Will there be *any* compilers available for Ada 2005 suitable ...
    (comp.lang.ada)
  • Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... >> for J in A'Range loop ... since Ada eliminated most of Pascal's problems ... none of our 4 or 5 different C++ compilers complained about it. ... I would expect a programmer to know the ...
    (comp.lang.ada)