Path: utzoo!attcan!uunet!mcsun!sunic!kth!draken!d88-jwa From: d88-jwa@nada.kth.se (Reply via mail or intl. +46 8 258 268...) Newsgroups: comp.sys.mac.programmer Subject: Re: Integer Size problem Message-ID: <1480@draken.nada.kth.se> Date: 24 Aug 89 12:16:49 GMT References: <15141@dartvax.Dartmouth.EDU> <11689@cit-vax.Caltech.Edu> <1465@draken.nada.kth.se> <8377@hoptoad.uucp> Reply-To: d88-jwa@nada.kth.se (Jon W{tte) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 46 In article <8377@hoptoad.uucp tim@hoptoad.UUCP (Tim Maroney) writes: In article <11689@cit-vax.Caltech.Edu palmer@tybalt.caltech.edu.UUCP (David Palmer) writes: A better way, clearer and probably faster, however is to just do: **(rect **)myHandle = myRect; You don't have to lock anything down, it is a single easy to understand In article <1465@draken.nada.kth.se d88-jwa@nada.kth.se (Jon W{tte) writes: Wrong. Incorrect. What happens if a interrupt happens between the set pointers and the block move instruction ? And this interrupt happens to shuffle memory ? LOCK THE HANDLES first ! ALWAYS ! Many people have said things about this. For instance: Wrong. Incorrect. Interrupts are forbidden to shuffle memory. Lock handles only when you need to; you risk fragmenting the heap otherwise. I should have said: "And unlock them again when you don't dereference them," but I though that was a clear issue. What's NOT a clear issue is the following: May OS interrupts move or purge memory ? Apple may do as it damned well pleases in many other cases, so what about this ? After all, most of the handle manipulation is in DoVBLTask in ROM... **myhandle.boundrect = myRect; /* ^ or whatever the element name is */ Both Inside Mac and the TechNotes tell us no to change any fields in windows or GrafPorts directly. But since everybody's doing it, they won't DARE change anything :-) So? He's not changing anything in a window or graphics port, he's changing something in a window template resource. If the difference isn't clear to you, I recommend re-reading the Window Manager chapter of Inside Mac. I'm sorry, I saw only boundsRect, which I translated as a struct Window element in my mind. You're right and I'm wrong in this case. Happy hacking everyone :-) -- This is your fortune from h+@nada.kth.se: A bird in the hand is worth what it will bring.