gwyn@brl-smoke.ARPA (Doug Gwyn ) (06/07/88)
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 <stddef.h>, one could implement pointer_t on old compilers virtually >>painlessly. Old C implementations don't have <stddef.h>. 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.