#define void int vs. #define void char

Karl Heuer karl at haddock.ISC.COM
Tue Jun 7 02:28:12 AEST 1988


In article <11823 at mimsy.UUCP> chris at 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.

My temporary workaround is to use "Void *" (note the capital V) for generic
pointers.  It's easy to make this work on either K&R or ANSI compilers.  I
chose not to make a non-standard "pointer_t" because "Void *" more closely
resembles the "real" syntax, and is easy to fix when I decide that the
workaround is no longer necessary.

My alternate solution would be to write a PD preprocessor that converts
"void *" to "char *", and other similar hacks.  (But to be worthwhile it
should also handle function prototypes; since this is nontrivial, I haven't
done it yet.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list