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,34437e7a9afa5f65 X-Google-Attributes: gid103376,public From: jsa@alexandria.organon.com (Jon S Anthony) Subject: Re: X11Ada - Is Unchecked_Conversion commonly required? Date: 1997/07/17 Message-ID: #1/1 X-Deja-AN: 257540908 Distribution: world References: <33CAE473.4079@earthlink.net> Organization: PSINet Newsgroups: comp.lang.ada Date: 1997-07-17T00:00:00+00:00 List-Id: In article <33CAE473.4079@earthlink.net> James Thomas writes: > What I've noticed is an apparent requirement to use Unchecked_Conversion > an *awful* lot. Examples (I'll try to keep these succinct)follow. What I > need to know is this - Am I just missing something here - or is this > prevalent use of UC really needed with the Intermetrics bindings? Unknown - you don't give enough information. However, I can say this: In my use of these bindings, I have not needed to use UC except for the typical use in a callback structure (where X/Motif does not give enough information to be able to do anything otherwise - in C/C++ these typically have a cast to the correct type). > 1. When calling XtOpenDisplay, and passing X.Args.Argc to the argc > parameter, it is necessary (?) to use UC to convert the type of the No, pass the 'Access of this argument: Argc => X.Args.Argc'Access, > 2. More commonly - it is not uncommon to pass a widget to XtAddCallback > as the "closure" parameter. This was done rather simply when using > Telesoft's bindings, w/o using UC. This is an example of callback "data", so UC will be needed. I'm sure UC was used in this context too - just under the covers. Note that the Intermetric bindings are "thin" (a Good Thing, IMO). > 3. When using old-style args (not Va args), which is still required > for some subprograms, it is necessary to use UC to stuff data into > the XtArg. UC was not needed in Telesoft's bindings. Haven't done this, but that is probably true. > I am finding more examples every day. I am new to Ada 95 (but I'm an The rule of thumb would be, anywhere the X/Motif docs (say the O'Reily books) say to cast, you will probably need to UC, as these are thin bindings and directly reflect the C level semantics. As I say, I think this is a good thing as it doesn't pretend that the underlying SW is anything but your typical C rubbish. Plus, you can use the C references pretty much verbatim - no need for extraneous documentation for how the thick bindings work. /Jon -- Jon Anthony OMI, Belmont, MA 02178 617.484.3383 "Nightmares - Ha! The way my life's been going lately, Who'd notice?" -- Londo Mollari