Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!purdue!gatech!bbn!lawrence From: lawrence@bbn.COM (Gabriel Lawrence) Newsgroups: comp.sys.mac Subject: Re: Philosophical programming question: handles Message-ID: <6713@ccv.bbn.COM> Date: 9 Feb 88 17:39:13 GMT References: <870130@hpcilzb.HP.COM> <5192@well.UUCP> Reply-To: lawrence@ccv.bbn.com.BBN.COM (Gabriel Lawrence) Organization: Bolt, Beranek and Newman Inc., Cambridge MA Lines: 32 (Michael Zentner) writes: >In terms of straight "C" programming, a Handle is just a pointer to a >pointer... Not to point any fingers but I've yet to see anyone answer this question directly. The above statement is incomplete, substituting "Pascal" or "Assembly Language" or "Forth" for "C" would have precisely the same connotation. Although the simplest way to represent the Handle as a data structure in 'C' is to use 'typedef char **handle', that does not take the complete definition of a handle into consideration. A handle is defined as a pointer to a master pointer which points to a relocatable block of memory. Because the memory manager may relocate these blocks of memory at it's own convenience, a programmer must always be aware that his/her dereferenced pointer to his/her data may or may not still be valid. A data structure which was truly representative of a handle would have to include references to master pointers, lock/unlock bits and all that nonsense. Of course to preserve a transparent memory management interface (ie. to allow software to retain compatibility whether or not a MMU is utilized) you are better off 'hiding' portions of your data structure (such as the lock/unlock mechanisms) and providing data structure specific subroutines or macros which manipulate certain portions of your elementary data structure (Right Apple??!! :-) ). I'm beginning to ramble but I hope my point is clear - the method (or language) by which access to a data structure is used does _not_ necessarily define the actual structure of the data. Now then, who can cite actual instances where a handle-based data structure has been used within a contemporary operating system? Extra points awarded if you can also cite the data structure (in any language) used to represent it. =Gabe Lawrence= USENET: ...!harvard!lawrence@bbn.com =BBN Communications= INTERNET: lawrence@BBN.COM