This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: (printf) ("hello world\n");
Geoff Keating wrote:
>
> 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).
But without <stdio.h> the varargs attribute is not present and all is
well. Naturally, it may very well fail to execute correctly, but this
is not the issue here.
--
Eyal Lebedinsky (eyal@eyal.emu.id.au) <http://samba.org/eyal/>