Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!ncar!ico!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: A dilemma with handles Message-ID: <18390@haddock.ima.isc.com> Date: 3 Oct 90 03:50:21 GMT References: <3877@goanna.cs.rmit.oz.au> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Distribution: comp Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 14 In article <3877@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: >In article , markd@iti.org (Mark Delany) writes: >> Now my question relates to the definition of "handle". Within the >> library this is simply a pointer to a structure that holds all the >> goodies necessary to achieve the results. > >[Use an incomplete struct type] I agree. If you use `void *', the compiler will probably silently allow them to be assigned to/from arbitrary pointer types; you're making it a lot easier for the user to make certain kinds of mistakes. With an incomplete type, the user gets the full benefit of type-checking. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint