char* vs void* (was: Comparison functions for qsort() and bsearch())

David Brooks dbrooks at penge.osf.org
Fri Dec 28 17:00:14 AEST 1990


In article <2778A795.6E71 at tct.uucp> chip at tct.uucp (Chip Salzenberg) writes:
>
>The ANSI C standard requires that |char *| and |void *| have identical
>representations.  This requirement bows to existing practice.  After
>all, before ANSI came along, the return type of malloc() was |char *|.
>So pre-ANSI C's generic pointer type was, of necessity, |char *|.

How's that again, again?

I don't understand.  In the case of void*, what is being represented?
I mean, what semantic commonality is there between the object popinted
at by a char* and the unobject pointed at by a void* that allows you
to make this statement?

Do you mean "can both be converted to the same integer type and back
without loss of information?"  Do you mean "can be converted to each
other and back without loss of information?"

Damn: my question-mark key just wore out.
-- 
David Brooks				dbrooks at osf.org
Systems Engineering, OSF		uunet!osf.org!dbrooks
In Memoriam: Chris Naughton, aged 16, killed by a drunk driver Dec 22, 1990



More information about the Comp.lang.c mailing list