comp.lang.ada
 help / color / mirror / Atom feed
* Non private & private Import
@ 2000-12-16 13:48 Antonio Vargas
  2000-12-16 17:11 ` Robert Dewar
  0 siblings, 1 reply; 2+ messages in thread
From: Antonio Vargas @ 2000-12-16 13:48 UTC (permalink / raw)



Hi.

What are the advantages/disadvantages of

--  First version

package Imp_Xfuncs is
   function Example (num : C.int) return C.int;
   pragma Import (C, Example, "the_example");     -- Non private "Import"
end Imp_Xfuncs;


--  Second version

package Imp_Xfuncs is
   function Example (num : C.int) return C.int;
private
   pragma Import (C, Example, "the_example");   -- Private "Import"
end Imp_Xfuncs;

Thanks in advance 

Antonio Vargas



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

* Re: Non private & private Import
  2000-12-16 13:48 Non private & private Import Antonio Vargas
@ 2000-12-16 17:11 ` Robert Dewar
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Dewar @ 2000-12-16 17:11 UTC (permalink / raw)


In article <976978132.359056@tubarao.ip.pt>,
  antonio.vargas@clix.pt wrote:
>
> Hi.
>
> What are the advantages/disadvantages of

<<examples snipped>>

They are equivalent semantically. So choose on the
basis of whether you think it is part of the public
interface or not.

In the specific examples you gave, there were no
comments, which seems a bad thing. Given the lack
of comments, you have to prefer the public import,
since at least that gives some information about
what on earth the subprogram does. The private
version is completely useless since it gives the
client absolutely not the slightest clue as to
what the subprogram is for.

In either case, comments would be a highly desirable
addition, and would focus your attention on the
issue you are raising, which is whether or not it
is part of the public interface that the subprogram
is imported and has convention C.

If you want to be really persnickety, it SHOULD be
part of the interface that the convention is C,
because this is semantically visible, but in practice
it is very unlikely to make a difference. For most
purposes anyway it makes sense to have the import
be right next to the subprogram declaration.


Sent via Deja.com
http://www.deja.com/



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

end of thread, other threads:[~2000-12-16 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-16 13:48 Non private & private Import Antonio Vargas
2000-12-16 17:11 ` Robert Dewar

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