Do you have to cast void pointers when dereferencing them?

Henry Spencer henry at utzoo.uucp
Fri Dec 16 04:09:43 AEST 1988


In article <2414 at ssc-vax.UUCP> dmg at ssc-vax.UUCP (David Geary) writes:
>...  Under ANSI C, do I HAVE to cast
>my void pointer, or not?

Yes.  Deferencing a void pointer, whether directly via * or [] or more
obscurely via ->, is forbidden.

Many old compilers are quite sloppy about what they accept on the left
of the -> operator, but this has not been legitimate C for quite a while.
-- 
"God willing, we will return." |     Henry Spencer at U of Toronto Zoology
-Eugene Cernan, the Moon, 1972 | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list