Re: HI, a question on #include
- From: Jack Klein <jackklein@xxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 13:10:37 -0600
On 31 Mar 2006 08:48:33 -0800, "sunnylele" <sjsongjing@xxxxxxxxx>
wrote in comp.lang.c:
Hi, all,
I have a question on the use of #include:
#include <unistd.h>
#include <asm/unistd.h>
#include "nn.h"
What are the differences between the above three usages?
It seems the third one allows the code to include the nn.h in the same
directory of the code;
the first one allows the code to include the unistd.h from some other
directory without any specification;
the second one asks the code to include the unistd.h under
somedirectory .../asm/unistd.h.
Then another question is:
If there exist 2 files named unistd.h, one is
.../sys/unistd.h, the other is .../asm/unistd.h, which one will be
included by
#include <unistd.h>
Thanks for your help!
Jing
All the C standard has to say about this is that there are two forms
of the include preprocessor directive. One is:
#include <q-char-sequence>
....and the other is "q-char-sequence".
The standard C headers, 15 in C90, 18 in C95, and 24 in C99, must use
the first form.
It also specifies that for other than the standard C headers, the
directive causes the preprocessor to process the contents of files at
that point in the original file.
Finally it specifies that the <> form causes a search for a file in an
implementation-defined manner. The "" form causes a search for a file
in a (possible different) implementation-defined manner, and if that
search fails, then it searches in the same manner that it will then
search in the manner it does for the <> form.
So it is entirely up to your compiler, operating system, and perhaps
the settings of configuration options what actually happens here. You
need to ask in a group that supports your compiler/OS combination for
specifics on how your compiler behaves.
Perhaps news:comp.os.linux.development.apps or
news:comp.unix.programmer.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.
- References:
- HI, a question on #include
- From: sunnylele
- HI, a question on #include
- Prev by Date: Re: A question on variable defination
- Next by Date: Re: What will happen if main called in side main function?
- Previous by thread: HI, a question on #include
- Next by thread: What will happen if main called in side main function?
- Index(es):
Relevant Pages
|
|