This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: about including header files
- From: Andrew Haley <aph at redhat dot com>
- To: yacson <yactiem at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 10 Nov 2009 11:07:31 +0000
- Subject: Re: about including header files
- References: <26281601.post@talk.nabble.com>
yacson wrote:
Hi everybody.
what happens if a "header include" is missing? because I unexpectedly notice
that this code:
main()
{printf("hello");}
works in linux(at least on my (mandriva spring 2007 )box) while it does not
in windows(turbo C++).
so finally, can I say : #include <stdio.h> is not always necessary!
Strictly speaking, I think this is undefined behaviour. So, while it
might work, it's not correct code, and it may break at any time.
another question is : where does the compiler (or the linker) find the
actual code of printf (whether or not one has written its prototype)
It's in the C library. The C library is not part of gcc.
Andrew.