%p and different pointer representations
Henry Spencer
henry at utzoo.uucp
Tue Feb 28 02:59:13 AEST 1989
In article <597 at jhereg.Jhereg.MN.ORG> mark at jhereg.MN.ORG (Mark H. Colburn) writes:
>... I spent last night re-reading the pANS, and there
>is a paragraph which states that (void *) must be the same size and have
>the same alignment as (char *). This seems really silly to me. Why
>introduce a new type if it has no new functionality? ...
The functionality of "void *" is to be a replacement for all the places
where "char *" was used as a generic pointer because there wasn't any
generic pointer. For example, the first argument to fwrite(). If "char *"
was not generic enough for those places in your implementation, your
implementation was broken to begin with. The requirement for representation
compatibility with "char *" is vital for backward compatibility with all
that code that *does* use "char *" as a generic pointer.
If you study things like the conversion rules, you'll see that "void *"
does have new functionality. But expecting it to fix your broken compiler
(or the broken machine that is the cause of the compiler breakage) is a
bit too much to hope for.
--
The Earth is our mother; | Henry Spencer at U of Toronto Zoology
our nine months are up. | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list