A dilemma with handles

Karl Heuer karl at haddock.ima.isc.com
Wed Oct 3 13:50:21 AEST 1990


In article <3877 at goanna.cs.rmit.oz.au> ok at goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>In article <markd.654876849 at sunchat>, markd at 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 at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list