Path: utzoo!attcan!sobmips!uunet!samsung!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!purdue!decwrl!shelby!portia!forel!karish From: karish@forel.stanford.edu (Chuck Karish) Newsgroups: comp.unix.ultrix Subject: Re: cc mishandles *void? Message-ID: <6707@portia.Stanford.EDU> Date: 16 Nov 89 14:08:48 GMT References: <1239@atha.AthabascaU.CA> Sender: USENET News System Reply-To: karish@forel.stanford.edu (Chuck Karish) Distribution: comp Organization: Mindcraft, Inc. Lines: 25 In article <1239@atha.AthabascaU.CA> lyndon@cs.AthabascaU.CA (Lyndon Nerenberg) wrote: >While compiling bash under Ultrix 2.3 I ran across an interesting >piece of C that chokes cc(1) under Ultrix 2.3, but compiles fine >under SunOS3.5 and under Ultrix 2.3 using gcc. > >The idea of passing parameters as 'void *mumble' seems a bit >questionable. Is the compiler correct to complain about this? >Can someone try it under 3.1 and let me know what it says? `void *' is the correct type for generic storage under ANSI C. malloc(), calloc(), and realloc() return pointers to void. The pointers are normally cast to a specific data type before use. There's nothing wrong with having a function allocate generic storage and pass its address to another function. The Portable C Compiler recognizes void as a pseudo-type, for functions that don't return a value. It does not recognize it as a storage type. gcc supports the ANSI usage. The MIPS C compiler on the DS3100 under 3.1 does not. Chuck Karish karish@mindcraft.com (415) 323-9000 karish@forel.stanford.edu