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!newsfeed.stanford.edu!bloom-beacon.mit.edu!llslave.llan.ll.mit.edu!53ab2750!not-for-mail From: "Frank J. Lhota" User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: pragma import ambiguity References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 06 Sep 2006 13:34:27 -0400 NNTP-Posting-Host: 155.34.132.75 X-Complaints-To: news@ll.mit.edu X-Trace: llslave.llan.ll.mit.edu 1157564201 155.34.132.75 (Wed, 06 Sep 2006 13:36:41 EDT) NNTP-Posting-Date: Wed, 06 Sep 2006 13:36:41 EDT Xref: g2news2.google.com comp.lang.ada:6482 Date: 2006-09-06T13:34:27-04:00 List-Id: 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.