From: john carmack <migrate_linux@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: Re:RFC:Booleans and the kernel
Date: Fri, 25 Jan 2002 03:33:53 -0800 (PST) [thread overview]
Message-ID: <20020125113353.90801.qmail@web20110.mail.yahoo.com> (raw)
> > > #include <stdio.h>
> > >
> > > int main()
> > > {
> > > char x;
> > >
> > > if ( x )
> > > {
> > > printf ("\n We got here\n");
> > > }
> > > else
> > > {
> > > // We never get here
> > > printf ("\n We never got
here\n");
> > > }
> > > exit (0);
> > > }
> > > covell@xxxxxx ~>gcc -Wall foo.c
> > > foo.c: In function `main':
> > > foo.c:17: warning: implicit declaration of
function `exit'
Version of my gcc:2.96
First of all i complied the file with the command gcc
file.c.I got an a.out file which worked properly.The
output is we got here properly.
So the compiler is pretty intelligent .
Now if you compile with gcc -Wall file.c it gives an
error called implicit declaration of function 'exit'
.That is true refer to your system manual or man page
.It shows that void exit(int status) function which we
are using in the program needs a header file called
stdlib.h to be included.
If we include that header file by #include <stdlib.h>
in the program and compile with gcc -Wall file.c
we don't get the error but we get the required output.
To get uninitialized variables we need to compile it
with the command gcc -Wall -O file.c or gcc
-Wuninitialized -O file.c.For me it gives an error
saying warning:'x' might be uninitialized.
I think it clarifies the doubt.
Before including functions it is a good thing to check
whether the header files are included because for me
while coding ,although my program(C code) was correct
since i didn't compile it properly with library
extension like -lm for math.h or didn't include some
header files it gave me an error.
Hope that solves your doubt.
-----*-------------------------------------------*-----
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
reply other threads:[~2002-01-25 11:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020125113353.90801.qmail@web20110.mail.yahoo.com \
--to=migrate_linux@yahoo.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®