[XForms] New pre-release: xforms-1.0.92pre3

JOEL.MOOTS at L-3com.com JOEL.MOOTS at L-3com.com
Mon May 18 16:45:38 CEST 2009

To subscribers of the xforms list

>   Another thing I am rather unhappy with is the prototypes for
> callback functions. Some callbacks take a 'long' as the second
> argument, others a void pointer. There doesn't seem to be any
> obvious reason why one of them is used. And in some situations
> a 'long' value is quite useful, but in others a void pointer
> is much better and when there's only a 'long' that can be passed
> to the callback there's the temptation to use casts between
> pointer and integer types (that work on a lot of architectures
> but aren't correct C and may fail on some architectures). IMHO
> it would be best if each callback would receive both a long and
> a void pointer. But that would break a lot of existing code. If
> anybody has a good idea on how to deal with that I would be de-
> lighted to hear about it!

I've always wondered about this too. I suppose I'm ignorant when it
comes to many architecture issues, but the only reason I can think of
for using some long type rather than always void *  would be to allow
use of data in some cases without a cast. Personally, I think it should
always be void *, but that would obviously break existing code that does
not cast. I don't see how casting from void * to integer types is not
'correct' C (which probably just says something of my programming);
isn't that pretty much the standard way all Xt stuff works? So, I don't
really see any value in adding an additional arg.

I don't have much 64-bit experience, but I could see how using a long
might fail (if long were no longer large enough to hold all pointer
types), in which case, switching to void * would necessary, since it is
guaranteed to be large enough. Or we could possibly use a typedef
somewhere (akin to the XtPointer) and always use that type. Then most
folks, if they desired a long type everywhere, could probably use it
with little to no compile errors..



P.S.: Jens, I know I'm a lurker so don't say this enough (have I ever?),
but thanks for all your hard work.
To unsubscribe, send any message to
xforms-leave at bob.usuhs.mil or see: 
List Archive: http://bob.usuhs.mil/pipermail/xforms and
XForms Home: http://savannah.nongnu.org/projects/xforms

More information about the Xforms mailing list