Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!tank!gft_robert@gsbacd.uchicago.edu From: gft_robert@gsbacd.uchicago.edu Newsgroups: comp.sys.mac.programmer Subject: Casting Integer to SignedByte in THINK Pascal Message-ID: <5728@tank.uchicago.edu> Date: 9 Oct 89 19:14:34 GMT Sender: news@tank.uchicago.edu Distribution: na Organization: University of Chicago Graduate School of Business Lines: 31 Here's a really simple problem that's bugging me: I want to write out an integer to a specific location in memory, something like this: var myPtr:Ptr; myInt:integer; begin myPtr:=some location in memory; myInt:= some value <=32k; myPtr^:=SignedByte(myInt); end; OK, so far so good. My compiler (THINK Pascal) doesn't choke on this, so it would seem to be OK. But it still doesn't choke on it if I make myInt > 255. Since SignedByte is defined in IM as 0..255, it shouldn't let me do that (range checking is turned on), and if I do do it, won't I be overwriting two bytes in memory, not one? Your elucidations and explanations gratefully awaited, Robert ============================================================================ = gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to = = crsp_ra@gsbacd.uchicago.edu * all my opinions are * compute" = = * mine * -Kraftwerk = ============================================================================