Varargs problem

MARWK at levels.sait.edu.au MARWK at levels.sait.edu.au
Tue Aug 29 01:50:19 AEST 1989


In article <4YxPuc200VsnE_B3Jy at andrew.cmu.edu>, bobg+ at andrew.cmu.edu (Robert Steven Glickstein) writes:
> I wish to extract a variable of type "pointer to function returning int"
> [(int (*) ())] from a varargs parameter list, and I can't. 
> 
> I might be able to do
> 
>     fn = (int (*) ()) va_arg(ap, char *);
> 
> but I don't know how portable this is, ...

I am not an expert, but it seems to me that one can always cast a pointer
to a pointer of another type, so the above is portable - a problem might
occur if one has a FAR pointer cast to a NEAR pointer, but this is architecture
specific anyway.

Ray



More information about the Comp.lang.c mailing list