comp.lang.ada
 help / color / mirror / Atom feed
From: "Frank J. Lhota" <flhota.NOSPAM@ll.mit.edu>
Subject: Re: pragma import ambiguity
Date: Wed, 06 Sep 2006 13:34:27 -0400
Date: 2006-09-06T13:34:27-04:00	[thread overview]
Message-ID: <JGDLg.2382$O5.1258@llslave.llan.ll.mit.edu> (raw)
In-Reply-To: <fbidnR4YeKBfbGPZnZ2dnUVZ_r6dnZ2d@comcast.com>

tmoran@acm.org wrote:
> One Ada compiler accepts this, another doesn't. I agree with the one that
> objects.  Are we wrong?
> procedure testimp is
>   type logicopenm is ( clear, gl_and);
>   procedure clear(mask:integer);
>   pragma import(stdcall,clear,"glclear");
> begin
>   null;
> end testimp;

This is a tough call. Technically, an enumeration literal such as "clear" in

	type logicopenm is ( clear, gl_and);

is an implicit, parameterless function. Section B.1 of the ARM states 
"If the local_name denotes more than one entity, then the pragma Import 
is the completion of all of them", so one could argue that the import 
clause imports a subprogram for *both* the clear procedure and the 
enumeration literal. This is clearly not possible: the "clear" 
enumeration literal must be implicit.

Of course, one may argue that B.1 should not apply to enumeration 
literals, but even so, this kind of overloading is not recommended. My 
advice would be to give the enumeration literal and the procedure 
separate names.



  parent reply	other threads:[~2006-09-06 17:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06 16:05 pragma import ambiguity tmoran
2006-09-06 16:39 ` bubble
2006-09-06 16:42   ` bubble
2006-09-06 17:47   ` Pascal Obry
2006-09-21  1:26   ` Dave Thompson
2006-09-06 17:34 ` Frank J. Lhota [this message]
2006-09-06 18:06   ` Gautier
2006-09-07  7:53   ` Dmitry A. Kazakov
2006-09-07 19:35   ` Adam Beneschan
2006-09-08  3:48     ` Randy Brukardt
replies disabled

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