comp.lang.ada
 help / color / mirror / Atom feed
* pragma on overloaded subprograms
@ 1999-08-12  0:00 bourguet
  1999-08-14  0:00 ` Robert Dewar
  0 siblings, 1 reply; 2+ messages in thread
From: bourguet @ 1999-08-12  0:00 UTC (permalink / raw)


In the Intermetrics X11 ada binding (yes, I'm currently examining
these :-) there are several pairs of function like this (still
from memory):

function toto(..., p: charp;...) return ...;
pragma import (C, toto, "toto");

function toto(..., p: char_array; ...) return ...;
pragma inline (toto);

with a body for the second toto (the one with char_array); the
body just call the first function after having appended a NUL to
the array.

As I understand the RM, both pragmas are supposed to apply to both
functions and we are supposed to use renaming to make this kind of
things. So I was wondering if I've misunderstood something in the
RM or if the bindings here rely on a bug in gnat.

BTW, with gnat 3.11p, removing the body give an error "missing body".
When I remove the pragma inline, the error still araise. When I move
the import pragma past the second declaration, all compile fine.
(And run fine because in my test case the array was a litteral and
gnat seems to append a nul to all string litterals). This last behavior
was the one I had assumed until I remarked the pragma inline.

-- Jean-Marc


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pragma on overloaded subprograms
  1999-08-12  0:00 pragma on overloaded subprograms bourguet
@ 1999-08-14  0:00 ` Robert Dewar
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Dewar @ 1999-08-14  0:00 UTC (permalink / raw)


In article <7ounsm$7l3$1@nnrp1.deja.com>,
  bourguet@my-deja.com wrote:
> As I understand the RM, both pragmas are supposed to apply to
> both functions

You are missing one of the most fundamental points of
Ada semantics -- linear elaboration (*) -- a pragma cannot
apply to a declaration that has not been seen yet!!!!

(*) Yes, I know, compiler writers tackling the mysteries of
private types, overriding etc etc are laughing in the aisles :-)

Robert Dewar


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-08-14  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-12  0:00 pragma on overloaded subprograms bourguet
1999-08-14  0:00 ` Robert Dewar

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