help with a MESSY C definition!!?
Blair P. Houghton
bph at buengc.BU.EDU
Sat Nov 26 05:44:11 AEST 1988
In article <950 at vsi.COM> friedl at vsi.COM (Stephen J. Friedl) writes:
>In article <1506 at buengc.BU.EDU>, bph at buengc.BU.EDU (Blair P. Houghton) writes:
>> Now, prove that
>>
>> (int *(*)())
>>
>> is unambiguously "cast to pointer to function returning pointer
>> to int" and never misinterpreted as "cast to function returning pointer
>> to pointer to int," whatever the hell that means...
>
>Casts are "abstract declarations". This means that if you drop the
>outer parens, there is exactly one place where a variable name (say,
>`foo') could be inserted to make this a real declaration. Above,
>the only place would be:
>
> int *(*foo)()
>
>So, this is "cast to ptr to function returning ptr to int".
But is there anything illegal about
int *(*)foo()
and would those "extra" parentheses change the precedence of that *
declarator at all, viz
double *barz[] /* declare barz as array of ptr to double */
double (*)barz[] /* declare barz as ptr to array of double.
Or does it? */
--Blair
More information about the Comp.lang.c
mailing list