Re: HI, a question on #include



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
.



Relevant Pages

  • Re: HI, a question on #include
    ... It also specifies that for other than the standard C headers, ... implementation-defined manner. ... So it is entirely up to your compiler, operating system, and perhaps ... Boeing Associate Technical Fellow ...
    (comp.lang.c)
  • Re: stdio.h ?
    ... That means when you use stdio.h you are using the same standard IO ... > the C standard and the implementation is specified by the compiler. ... > The header should be about the same in all libraries, because it specifies ...
    (comp.lang.c)
  • Re: Question about size and memory layout of a Union.
    ... The question itself specifies that the machine is little endian and ... has a 32-bit word alignment for memory access and an unsigned integer ... Unfortunately for the purpose of your question, the C Standard ... A 16-bit compiler might give a different answer from a 32-bit compiler ...
    (comp.lang.c)
  • Re: Whats the best language to learn...
    ... work properly on any standard-conforming C compiler. ... what the C++ standard specifies. ... standard and thus not part of the C programming language, ...
    (comp.programming)
  • Re: strlen in a for loop with malloc-ed char*
    ... A standard compliant strlen is not allowed to change the string. ... In fact the standard only specifies what operators do, ... The compiler can optimise out calls to ...
    (comp.lang.c)