From: fred AT genesis DOT demon DOT co DOT uk (Lawrence Kirby) Newsgroups: comp.lang.c,comp.os.msdos.djgpp Subject: Re: Casting void pointers Date: Mon, 22 Jun 98 10:33:56 GMT Organization: none Message-ID: <898511636snz@genesis.demon.co.uk> References: <6mkaos$k7o AT dfw-ixnews6 DOT ix DOT netcom DOT com> <358DC1FA DOT 443E297D AT cs DOT com> Reply-To: fred AT genesis DOT demon DOT co DOT uk Lines: 26 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <358DC1FA DOT 443E297D AT cs DOT com> fighteer AT cs DOT com "John M. Aldrich" writes: ... >#include > >int foo( int x ) >{ > return x + 10; >} > >int main( void ) >{ > void *vp = foo; Your compiler should have generated a diagnostic for this. The C language requires a cast to convert between void * and function pointers (in both directions). Note that C doesn't guarantee that a void * object can properly hold a funciton pointer. You should avoid doing this. -- ----------------------------------------- Lawrence Kirby | fred AT genesis DOT demon DOT co DOT uk Wilts, England | 70734 DOT 126 AT compuserve DOT com -----------------------------------------