Dumb question on dyn. mem. alloc (i

tp at ndm20 tp at ndm20
Wed Jul 31 02:06:00 AEST 1985


>I just realised a major problem with (void *). On machines like the HP-1000
>a pointer to a byte and a pointer to a word don't have the same bit-pattern.

That is probably try of ANY machine which is addressed by some unit larger
than a byte. We use a Harris H series computer, which is word addresseable
(24-bit words, even), and a pointer to a char definately does NOT look like
a pointer to anything else. You have to cast them properly. I don't know about
void, as I haven't seen the ANSI C draft, but on the Harris, anything that 
returns a "generic" pointer must return a char pointer with word alignment.
It then MUST be cast to the appropriate type (which reformats the pointer
properly). A pointer to void would presumably have to use the same approach.



More information about the Comp.lang.c mailing list