cc mishandles *void?

Chuck Karish karish at forel.stanford.edu
Fri Nov 17 01:08:48 AEST 1989


In article <1239 at atha.AthabascaU.CA> lyndon at 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 at mindcraft.com
	(415) 323-9000		karish at forel.stanford.edu



More information about the Comp.unix.ultrix mailing list