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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6491d3799d35186b,start X-Google-Attributes: gid103376,public From: heatwole@his.com (Kevin D. Heatwole) Subject: String parameters to exported routines - What should a compiler do? Date: 1997/06/03 Message-ID: #1/1 X-Deja-AN: 245976679 Organization: Heller Information Services, Inc. Newsgroups: comp.lang.ada Date: 1997-06-03T00:00:00+00:00 List-Id: I am still struggling to figure out exactly what a compiler should do when the Ada program contains an exported subprogram that has a parameter that is unconstrained. We have implemented what we thought was a reasonable thing to do, but now I am having second thoughts. What *should* a good Ada95 compiler do? I don't want to know what is legal or simply permissable, but what is expected for an Ada95 compiler. Here is an example: procedure S (Item : String); pragma Export (C, S); Should this be legal or should the declaration of S be rejected? If legal, should the compiler issue a warning that calling S from C involves passing the bounds of item in a compiler-dependent form? Or, should the compiler just generate code for the body of S that expects Item to just be the address of the first character that comprise the string and the bounds are assumed to be Positive'First .. Positive'Last (or whatever the bounds are on the index subtype)? Would the answers to the above make any difference if the parameter's type was Interfaces.C.Char_Array? What if S were called by Ada instead of C? Should the Ada call pass the actual bounds to S whereas the C call gets away with just passing the address of Item? Finally, what if S were imported instead? Should Ada calling S just pass the address of the first character of Item and just omit the bounds altogether? What do other Ada95 compilers do? Sorry for all the questions but I want to make sure that we handled this case in the best manner possible. We are about to make major release of our PowerAda compiler and I don't want to miss an opportunity to make this "right" (if we don't already handle this "right"). Kevin Heatwole OC Systems, Inc.