(printf) ("hello world\n");

Dale Johannesen dalej@apple.com
Tue Dec 9 21:01:00 GMT 2003


On Dec 9, 2003, at 12:40 PM, Michael Elizabeth Chastain wrote:

> I have a language lawyer question.
>
>   int main ()
>   {
>     (printf) ("hello world\n");
>     return 0;
>   }
>
> Is this a conforming C program?

c89 3.3.2.2:
"If the expression that precedes the parenthesized argument list in a 
function call
consists solely of an identifier, and if no declaration is visible for 
this identifier,
the identifier is implicitly declared exactly as if , in the innermost 
block containing
the function call, the declaration "extern int <identifier>();" 
appeared."

So the implicit declaration is not supposed to happen when the function 
identifier
is surrounded by parentheses, and this is not conforming.



More information about the Gcc mailing list