Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!elroy!cit-vax!andy From: andy@cit-vax.Caltech.Edu (Andy Fyfe) Newsgroups: comp.lang.c Subject: Re: const void * Message-ID: <6268@cit-vax.Caltech.Edu> Date: 26 Apr 88 06:05:01 GMT References: <6214@cit-vax.Caltech.Edu> Reply-To: andy@csvax.caltech.edu (Andy Fyfe) Distribution: na Organization: California Institute of Technology Lines: 25 In article <6214@cit-vax.Caltech.Edu> andy@cit-vax.UUCP (Andy Fyfe) writes: >What does (or should?) the ANSI standard say about const void *? The reason I wondered about this: Gnu C wants to be follow the rules according to ANSI. The current interpretation says that "void *" is the generic pointer, so it allows any * <--> void * const any * <--> void * and gives warnings for const any * <--> const void * any * <--> const void * ("any" here means any type other than "void".) RMS seems quite willing to make gcc conform to the rules. This has so far given me errors under 2 circumstances. The first occured when trying to compile Henry Spencer's string functions. The second occurs when using function prototypes that use "const void *" (like fwrite, etc.). As an aside, K&R 2 (section 7.8.5) makes it clear that the pointer returned by malloc must explicitly be cast to the correct pointer type. Why is this required, given that malloc returns a "void *"? -- Andy Fyfe andy@csvax.caltech.edu wjafyfe@caltech.bitnet andy@cit-vax.UUCP (...!ames!elroy!cit-vax!andy)