mikeoro@hubcap.clemson.edu (Michael K O'Rourke) (07/28/89)
This may turn out to be a really stupid question but here it goes: I had the distinct impression that VBL's could NOT call any routines that move memory or the machine would crash. However, in the February 1989 MacTutor, there is an example VBL that call the routine PlotIcon from within the VBL. The IM DA says that PlotIcon may move memory. So who is right? Is the IM DA wrong about that call? Did the person (Dick Chandler of Apple) who wrote the VBL do something illegal? Are routines that move memory okay sometimes, but not others? Confusedly, Michael O'Rourke
tim@hoptoad.uucp (Tim Maroney) (07/30/89)
In article <6082@hubcap.clemson.edu> mikeoro@hubcap.clemson.edu (Michael K O'Rourke) writes: >I had the distinct impression that VBL's could NOT call any routines >that move memory or the machine would crash. However, in the February >1989 MacTutor, there is an example VBL that call the routine PlotIcon >from within the VBL. The IM DA says that PlotIcon may move memory. > >So who is right? Is the IM DA wrong about that call? Did the person >(Dick Chandler of Apple) who wrote the VBL do something illegal? Are routines >that move memory okay sometimes, but not others? MacTutor is not a reputable magazine. Many of the Appletrons here used to spend time flaming the myriad errors and bad practices that appeared in each issues, but they finally gave up trying. The purpose of the magazine is to make money by advertising; it is not to exchange genuine information among skilled programmers. So, the answer is: MacTutor is wrong, Inside Mac is right. It is unsafe to do any graphics at the interrupt level because of the use of relocatable structures (region handles) in grafport data structures. There is no way to get around this safely because you aren't allowed to touch the visible region, so you can't lock the relocatable handles. Everything you read in MacTutor should be taken with a grain of salt roughly the size of the iceberg that sunk the Titanic. The fact is, they have as much as stated that they don't care about code quality. The classic example is the fake handle issue. They ran articles recommending that you could fake a handle without allocating one by simply having a stack pointer indicate another stack pointer. Calling the Memory Manager on these handles inside the system would very likely cause a crash. When the time came to reprint the articles in question, even though the editor had been told over and over that this was a horrible] practice, there was no change, not even a footnote. QED. I have not read an issue of the magazine in years. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "The negro slaves of the South are the happiest, and, in some sense, the freest people in the world. The children and the aged and infirm work not at all, and yet have all the comforts and neccessaries of life provided for them." -- George Fitzhugh, CANNIBALS ALL! OR, SLAVES WITHOUT MASTERS, 1857