jwright@atanasoff.cs.iastate.edu (Jim Wright) (12/11/89)
jackiw@cs.swarthmore.edu (Nick Jackiw) writes: | I-M is partially in error. You want to pass a pointer to the data | structure. (A regular pointer, not a Ptr.) And precisely what is the difference between a pointer and a Ptr? -- Jim Wright jwright@atanasoff.cs.iastate.edu
jackiw@cs.swarthmore.edu (Nick Jackiw) (12/12/89)
jwright@atanasoff.cs.iastate.edu (Jim Wright) writes: > jackiw@cs.swarthmore.edu (Nick Jackiw) writes: > | I-M is partially in error. You want to pass a pointer to the data > | structure. (A regular pointer, not a Ptr.) > And precisely what is the difference between a pointer and a Ptr? > -- > Jim Wright > jwright@atanasoff.cs.iastate.edu Sorry about that--I must have been drinking toxic slime, not coffee. (Hard to tell them apart, where I get my coffee.) By a pointer I meant an indirect address reference..you pass the address of a structure, not the contents of the structure, to the subroutine. Any time you have a Pascal function with a VAR argument, the compiler doesn't pass the *value* of your argument, it passes an actual pointer to where that particular value resides in memory. The subroutine then modifies the values addressed by the pointer, so that when the function returns, the value has changed in the actual variable passed as an argument. Pointer in the general sense. By a Ptr, I meant the data type which the Memory Manager returns when you call NewPtr. These must point to valid blocks in the application or system heap, and have properties associated with them, such as zone, size, etc. That's what I meant. What I ignored is that there are times in accessing the toolbox where procedures take Ptrs which must be heap- resident, NewPtr-created Ptrs (e. g. PtrZone(p:Ptr):THz;); and others which take Ptrs which can be general purpose pointers as above (e. g. BlockMove(sourcePtr,destPtr:Ptr;byteCount:Size);. Sorry for the confusion. -- _ _|\____ Nick Jackiw | Visual Geometry Project | Math Department / /_/ O> \ ------------+-------------------------+ Swarthmore College | O> | 215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081 \_Guernica_/ ------------+-------------------------+ USA