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

JOEL.MOOTS at L-3com.com JOEL.MOOTS at L-3com.com
Tue May 19 17:34:37 CEST 2009


To subscribers of the xforms list

> The problem with casting between (object) pointers and integers
> (be it normal ints or long ints) is that the C standard doesn't
> allow it - or at least declares it as only "implementation
> defined".
> I.e. it's not forbidden to work but also not guaranteed to work
> everywhere. On most architectures it indeed does work, but there
> seem to be some where it doesn't (I don't remember which ones that
> are, I would have to ask the guys in comp.lang.c, but there are
> some really weird architectures in the wild;-) and I guess that
> is why it's not allowed in general by the C standard.
 
Wow. Can't believe I've been living such an ignorant (and lucky) life so
far; I figured it said something about my programming. Anyway, as that
is the case, wouldn't it make sense to have all the prototypes use
'long' since the FL_OBJECT argument member that fl_set_object_callback
sets is 'long' anyway? It shouldn't break any existing code, and we'd be
consistent at least. Any conversions from 'void *' to 'long' and back
would continue to behave the same, and we could always switch any such
unsafe code to use the extra u_ members, right?

> I don't see at the moment how to get around the casting issue with
> typedefs. I am currently pondering if it would be possible to use
> a union with a long and a void pointer and perhaps to get it to
> work
> by use of some macros without breaking existing code (or at least
> not requiring extensive rewrites), but I haven't figured out any-
> thing that would work and isn't too ugly;-)

I can't think of *any* way (ugly or not) to allow this in C without
breaking code. I suppose we could duplicate a lot of code/members and
give the user the option of which type of callback to use, but, as
someone used to tell me, the "juice is not worth the squeeze."

-joel
_______________________________________________
To unsubscribe, send any message to
xforms-leave at bob.usuhs.mil or see: 
http://cweblog.usuhs.mil/mailman/listinfo/xforms
List Archive: http://bob.usuhs.mil/pipermail/xforms and
http://bob.usuhs.mil/mailserv/list-archives/
XForms Home: http://savannah.nongnu.org/projects/xforms



More information about the Xforms mailing list