Path: utzoo!utgpu!water!watmath!clyde!att!mtunx!rutgers!uwvax!oddjob!mimsy!eneevax!umd5!ncifcrf!nlm-mcs!brl-adm!brl-smoke!gwyn
From: gwyn@brl-smoke.ARPA (Doug Gwyn )
Newsgroups: comp.lang.c
Subject: Re: generic pointers (was: #define void int vs. #define void char)
Message-ID: <8029@brl-smoke.ARPA>
Date: 7 Jun 88 08:30:59 GMT
References: <8085@elsie.UUCP> <11823@mimsy.UUCP> <4420@haddock.ISC.COM>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) )
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 26

In article <4420@haddock.ISC.COM> karl@haddock.ima.isc.com (Karl Heuer) writes:
>In article <11823@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
>>Indeed, this is the root of an objection I have to the `void *' syntax
>>for generic pointers.  Had the standard included the line
>>	typedef void *pointer_t;	/* or (char *) */
>>in , one could implement pointer_t on old compilers virtually
>>painlessly.

Old C implementations don't have .  Chris's suggestion would
amount to a Standard C requirement that everybody define "pointer_t",
but by the Standard it can only be defined one way, namely "void *".
That's hardly worthwhile.  (The other *_t types provide implementations
with the opportunity to make a choice; this one wouldn't.)

There is nothing to keep you from having your own private standard
header that defines special types.  I've had one for many years; it
defines a "bool" (Boolean) type and a "pointer" (generic pointer)
type, among other things.  It is easy to tweak this header when
porting to a new system.  In fact, the definition of "pointer" could
be under control of "#if __STDC__".

>My temporary workaround is to use "Void *" (note the capital V) for generic
>pointers.

This amounts to the same thing.  I prefer to give the generic pointer
itself a type, rather than just a piece of it.