Mail Archives: djgpp/1998/06/22/17:16:14
Erik Max Francis wrote:
>
> Kaz Kylheku wrote:
>
> > 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;
>
> I think the original poster was really looking for the answer to the
> question: For a given declaration, how do I determine its type (for
> casting)?
>
> The answer is that if you remove the identifier name from the
> declaration, that's the type. So in the declaration int p, int is the
> type; in the declaration char *s, char * is the type, and in the
> declaration double (*p)(double, int), double (*)(double, int) is the
> type, even though it looks a little strange.
#ifdef PLUG
I'd like to mention that I have ported a program called `cdecl', whose
job it is to covert casts, declarations, etc., to and from readable
English. You can find it at my web site:
http://www.cartsys.com/eldredge/
#endif
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -