Void* Problem in BT

Blair P. Houghton bhoughto at hopi.intel.com
Fri Feb 8 04:40:28 AEST 1991


In article <43818 at nigel.ee.udel.edu> boutell at freezer.it.udel.edu (Tom Boutell) writes:
>void broadcast(messagetype,details)
>  char messagetype;
>  void* details;
>{
>      location* wherep;
>      wherep=(location*) details;
       ...
>
>Now, what happens is that in the line wherep=(location*) details; 
>some folks' C compilers report that details is undefined and give up.

Broken compiler, or one that does not have a concept of void?

`details' is very definitely defined at that point, provided
the compiler is one that knows of the keyword `void'.  Some don't.

Seems like there should be a lot of other warning bells, though,
like why it doesn't flag the syntax error due to `void* details'
if it can't swallow `void'.

Try putting

    #ifdef foo
    #define void char
    #endif

Where foo is a compiler-defined constant (you know, like
`apollo' or `vax' or `bsd') specific to that funky
compiler.  If the compiler doesn't know void, it's a fair
bet that (char *) is the proper generic pointer type.

				--Blair
				  "(void **)NULL."



More information about the Comp.unix.programmer mailing list