const void *
Andy Fyfe
andy at cit-vax.Caltech.Edu
Thu Apr 21 17:14:49 AEST 1988
What does (or should?) the ANSI standard say about const void *?
My intuition says that, so far as conversions without an explicit
cast go, the following should be legal:
any * <--> void *
const any * <--> const void *
any * --> const void *
const any * <-- void *
Or, void * is the generic pointer, and const is treated separately
as an attribute that can be added but not taken away (without an
explicit cast). Is this the way it is supposed to work?
If plain "void *" is to be the generic pointer, is K&R 2 correct
in defining memcmp as
int memcmp(const void *, const void *, size_t)
or fwrite as
size_t fwrite(const void *, size_t, size_t, FILE *)
for example?
Also, should "const any * --> void *" be allowed, since "void *"
is the generic pointer?
--
Andy Fyfe
andy at csvax.caltech.edu
wjafyfe at caltech.bitnet
andy at cit-vax.UUCP (...!ames!elroy!cit-vax!andy)
More information about the Comp.lang.c
mailing list