Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Genralizing Pointer Routines Message-ID: <14714@smoke.brl.mil> Date: 11 Dec 90 20:34:04 GMT References: Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 15 In article rg2c+@andrew.cmu.edu (Robert Nelson Gasch) writes: >In PASCAL, if you have 3 linked lists of different pointer types, >you have to write 3 different Insert, search & delete routines; one >for each pointer type. I was wondering if these routines can be >generalized for any pointer type in C? Yes, the simplest scheme is to have a special "linkage" substructure as the first member of each type of node structure. By appropriate use of casts etc., common link-manipulation routines can be used for all the node types, in a portable ("strictly conforming") manner. Tom Plum's "Reliable Data Structures in C" contains examples. You might also contact Karen Murray about obtaining the MUVES "Dq" package source code, which is a fairly elaborate implementation of the idea (complete with "lint" escapes).