char* vs void*

Chip Salzenberg chip at tct.uucp
Sat Jan 5 00:25:07 AEST 1991


According to bobj at glinj.gli.com (Robert Jacobs):
>What I can't understand is that ANSI decided that one cannot do pointer
>arithmitic on a void*, like a char*. Because of this, new work is forced
>to use char* as the generic pointer that can do pointer arithmitic.
>This continues the existing practice that char* is special.

Perhaps ANSI figured that since |char *| already serves as the generic
pointer that supports pointer arithmetic, making |void *| do the same
would render |void *| redundant and therefore useless.

As the language stands now, your choice of |char *| or |void *|
communicates to the compiler and to human readers your intentions
as to pointer arithmetic (|char *| if yes, |void *| if no).
-- 
Chip Salzenberg at Teltronics/TCT     <chip at tct.uucp>, <uunet!pdn!tct!chip>
"Please don't send me any more of yer scandalous email, Mr. Salzenberg..."
		-- Bruce Becker



More information about the Comp.lang.c mailing list