From: kaz AT cafe DOT net (Kaz Kylheku) Newsgroups: comp.lang.c,comp.os.msdos.djgpp Subject: Re: Casting void pointers Organization: Internet Direct Lines: 22 Sender: bill AT espresso DOT cafe DOT net Message-ID: <6mkfnv$hcr@espresso.cafe.net> References: <6mkaos$k7o AT dfw-ixnews6 DOT ix DOT netcom DOT com> Reply-To: kaz AT cafe DOT net Date: Mon, 22 Jun 1998 02:38:15 GMT NNTP-Posting-Host: 204.244.119.1 NNTP-Posting-Date: Sun, 21 Jun 1998 19:38:15 PDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <6mkaos$k7o AT dfw-ixnews6 DOT ix DOT netcom DOT com>, Todd Rowan wrote: >How do you explicity cast a void pointer to a function pointer? Or do you You can create a typedef name for the function pointer and then use the parenthesized typedef name. Or you can write cast expressions like: void *q = 0; double (*p)(double, int) = (double (*)(double, int)) q; Note that conversion between pointers to void and function pointers is not a feature of the C language; it is merely a common extension. In standard C, pointers to functions and pointers to object/incomplete types are incommensurable. >even need to cast void pointers manually? Yes; pointers to void may only be implicitly converted to object pointers or pointers to incomplete type. Converting a function point to void * and vice versa requires a cast operator.