This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


mec.gnu@mindspring.com (Michael Elizabeth Chastain) writes:

> I have a language lawyer question.
> 
>   int main ()
>   {
>     (printf) ("hello world\n");
>     return 0;
>   }
> 
> Is this a conforming C program?
> 
> There is no "#include <stdio.h>" so there is no declaration
> in scope for printf.

This would be nonconforming even if it was

int main()
{
  printf ("hello world\n");
}

since printf is a varargs function and so must be prototyped before it
is called (ISO C 6.5.2.2 paragraph 6).

(I think Dale answered the question you really wanted to ask.)

-- 
- Geoffrey Keating <geoffk@geoffk.org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]