From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9869a3929132e322 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 07 Sep 2006 22:46:57 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1157657721.734036.128160@h48g2000cwc.googlegroups.com> Subject: Re: pragma import ambiguity Date: Thu, 7 Sep 2006 22:48:25 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-YTYvdBnIad4j2c888hQzVvHf/WXhv5a6HcRlOVPLnSU2Di9UugTyljpcT6pISfIIMQ7TdRgUx3lG6q0!nps3WxD5dIbgUBgNQTDaVLwlUTPC2rfaDDcK4WzLnXxdYAHniHseMfStw6rCRpzq+8bf/CBYKg8N!OvM/9pujZgszng== X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:6515 Date: 2006-09-07T22:48:25-05:00 List-Id: "Adam Beneschan" 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.