From: jsa@alexandria.organon.com (Jon S Anthony)
Subject: Re: X11Ada - Is Unchecked_Conversion commonly required?
Date: 1997/07/17
Date: 1997-07-17T00:00:00+00:00 [thread overview]
Message-ID: <JSA.97Jul17183307@alexandria.organon.com> (raw)
In-Reply-To: 33CAE473.4079@earthlink.net
In article <33CAE473.4079@earthlink.net> James Thomas <jaimiethomas@earthlink.net> 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
prev parent reply other threads:[~1997-07-17 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-07-14 0:00 X11Ada - Is Unchecked_Conversion commonly required? James Thomas
1997-07-17 0:00 ` Jon S Anthony [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox