comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: pragma import ambiguity
Date: Thu, 7 Sep 2006 22:48:25 -0500
Date: 2006-09-07T22:48:25-05:00	[thread overview]
Message-ID: <xOudnfPr3rAvep3YnZ2dnUVZ_rGdnZ2d@megapath.net> (raw)
In-Reply-To: 1157657721.734036.128160@h48g2000cwc.googlegroups.com

"Adam Beneschan" <adam@irvine.com> wrote in message
news:1157657721.734036.128160@h48g2000cwc.googlegroups.com...
> Also, 6.3.1
> says that the function declaration that arises from the enumeration
> literal declaration has a default calling convention of Intrinsic, but
> it also says that default calling conventions can be overridden,
> although I can't see how it could make sense to override the default
> calling convention for an enumeration literal, or for that matter most
> or all of the other types of subprograms whose default calling
> convention is Intrinsic.  So I'm not sure why the language allows this
> "in principle".

Probably because there are Intrinsic routines where it does make sense to
override the calling convention (i.e. inherited routines).

> Anyway, the language isn't clear on whether Import can be applied to an
enumeration literal.

My understanding is that the intent is that the language allows
Import/Export to be applied to *any* entity. The theory being that we didn't
want to predict what we might be able to interface with in the future. For
instance, it might make sense to Import an exception on some implementations
(say, if C++ and Ada exceptions are implemented the same way). Similarly, it
might make sense to import literal values from another language, so I
suppose it could mean something somewhere.

But of course, these pragmas are required to work only for limited set of
entities, and enumeration literals isn't one of them.

> I do believe, though, that it would be wrong for a compiler to reject
this:
>
>     type logicopennm is (clear, gl_and);
>     pragma import (stdcall, clear, "glclear");
>
> when there's no overloading involved, but to accept the same pragma
> when it can be applied both to a subprogram named "clear" and to the
> enumeration literal.  The language does say that Import is the
> completion of all entities denoted by the name, and if such a
> completion is illegal for any denoted entity, then the compiler has to
> reject the pragma.


I agree with this.

                  Randy.





      reply	other threads:[~2006-09-08  3:48 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
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 [this message]
replies disabled

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