Re: My Bits are Flipping (or, "Why Can't I Be Negative?")

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello.

Arg.  That's not going to be good at all.  If this is the case, the user would 
have to 

1.  Guess whether or not the value is negative.
2.  Implement the poke/seek scenario every time they need the negative value.

Unfortunately, the C/Euphoria boundary in Midgard in quite close to the end 
user, although I had figured that it was far enough away.  The only way do 
handle this would be to have a hard-coded handler within the library, and 
then have a handler that is called from within the handler.  I'm worried 
about speghetti code with that strategy.

Derek, is this how win32lib deals with it?


Travis.




On Friday 27 August 2004 10:44 am, Andy Serpa wrote:
> Callback values are always treated as unsigned.  To get the negative
> number, do this:
>
> constant s4 = allocate(4) -- permanent allocation for speed
> function X(MWidget sender, atom x, atom y)
>
> poke4(s4,x)
> x = peek4s(s4)
>
> poke4(s4,y)
> y = peek4s(s4)
>
> -- x & y are now signed values
>
> .. more code here ..
>
> end function

-- 
Windows - what do you want to crash today?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu