Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!uunet!mcsun!ukc!cam-cl!news From: nmm@cl.cam.ac.uk (Nick Maclaren) Newsgroups: comp.windows.x.motif Subject: Re: writing Widgets with Float resources Message-ID: <1991May31.133337.7434@cl.cam.ac.uk> Date: 31 May 91 13:33:37 GMT References: <13743@dog.ee.lbl.gov> <910530224357.250@sony> Reply-To: nmm@cl.cam.ac.uk (Nick Maclaren) Distribution: inet Organization: U of Cambridge Comp Lab, UK Lines: 23 In article <910530224357.250@sony> nazgul@alfalfa.com (Kee Hinckley) writes: >> It appears that no matter what I try, XtSetValues passes junk >> as the float; as soon as I get into my SetValues function and >> take a look at what is passed, I get some bizarre value. This >Look at the structure. sizeof(float) is probably greater than >sizeof(long). You'll need to use pointers to float or some such. This may be the reason, though I rather doubt it. I suspect that you have been caught by a combination of the 'designs' of C and X. If XtArgVal is char *, you are in uncharted waters. Let us assume that it is long (which it often is). You are then going to end up with a coercion from float to long, which converts the value numerically. If you try to avoid this by casting it to void * or char *, you are back in uncharted waters! I advise trying XtVaSetValues - this is at least POSSIBLE to implement in ANSI C. However, be warned about automatic conversion to double in argument lists - there are some horrible traps in some compilers. Nick Maclaren University of Cambridge Computer Laboratory nmm@cl.cam.ac.uk