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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!labrea!jade!ucbvax!MITRE-BEDFORD.ARPA!emery From: emery@MITRE-BEDFORD.ARPA (Emery) Newsgroups: comp.lang.ada Subject: using 'address for callback Message-ID: <8709161313.AA01450@mitre-bedford.ARPA> Date: Wed, 16-Sep-87 09:13:47 EDT Article-I.D.: mitre-be.8709161313.AA01450 Posted: Wed Sep 16 09:13:47 1987 Date-Received: Fri, 18-Sep-87 07:09:04 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: It should be clear that passing 'address to X windows is at best non-portable. (A bit of history: subprogram variables are expressly forbidden by the language requirements, Steelman Paragraph 5D. Don't blame Ada the language for implementing Steelman the Requirements...) There are some significant potential problems in using 'address for 'callback'. I've used this trick on Verdix, and noted it as non-portable, but I have found some (perfectly reasonable) problems. In some instances, when procedure foo is invoked by C, I get program_error, due to the elaboration check. In general, an Ada program is responsible for insuring that subprograms get elaborated before they are executed, and the language requires this check. C, or some other non-Ada language, doesn't know how to play this game, and therefore when the C program invoked the Ada subprogram, I got the exception, because the C program didn't know how to tell the Ada program that it had been elaborated. In my instance, I was able to swear on a stack of Ada reference manuals that the subprogram had been elaborated before it was called by C, and applied "pragma suppress(elaboration_check);" to the subprogram, and everything worked ok. The moral of the story is that if you do something non-portable (and possibly erroneous) in Ada, you are not guaranteed that it will always work. For a (potential) standard, such as X windows binding, relying on such tricks as passing 'address is clearly unacceptable, due to the portability problems, and some of the other similar problems with the Ada semantics, such as elaboration checks. dave emery MITRE Ada Skills Center emery@mitre-bedford.arpa