⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inclk.kaz.html

📁 this is a mirrored site c-faq. thought might need offline
💻 HTML
字号:
<html><!-- Mirrored from c-faq.com/cpp/inclk.kaz.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 08:00:34 GMT --><head><title></title></head><body>From: Kaz Kylheku<br>Newsgroups: comp.lang.c<br>Subject: Re: include "file" or include &lt;file&gt;?<br>Message-ID: &lt;slrn7j29e6.loc.kaz@ashi.FootPrints.net&gt;<br>Date: Thu, 06 May 1999 05:16:54 GMT<p>On 6 May 1999 01:19:13 GMT, RaMzEyMe wrote:<br>&gt;What's the difference between putting<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;include "file"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;include &lt;file&gt;<br>&gt;in the preprocessor?<p>Let me draw you a diagram.<p><pre>        +-----------------------------------------------+        |                                               |        |         +--------------------------+          |        |         | places searched          |          |        |         | for &lt;&gt; includes          |          |        |         +--------------------------+          |        | places searched for "" includes               |        +-----------------------------------------------+</pre><p>Mnemonic: the <TT>&lt;&gt;</TT> suggests enclosure.<p>According to the language standard, a C implementation searches for headers intwo different ``places'' if they are included with <TT>""</TT>. It first looks in oneplace, and if it doesn't find the header there, it looks in the other place. <p>Headers that are included with <TT>&lt;&gt;</TT> are only searched for in the second place.<p>Imagine that the above diagram is being visited from outside in.<p>How this is done in actual implementations is quite commonly like this:headers included with <TT>""</TT> are first looked for in the same place where theirparent file (the one containing the <TT>#include</TT>) is located. If they are not foundthere, certain pre-defined places are searched; usually directories containingheaders that came with the implementation.<p>Various compilers have various ways to influence the behavior, which leads someprogrammers to structure their projects in various clever ways, such asseparating the include files from the source files.  Sometimes people eveninfluence the compilers to use <TT>&lt;&gt;</TT> searching for their own <p>The most portable thing to do is to use <TT>""</TT> for including files within yourproject, to use <TT>&lt;&gt;</TT> only for implementation supplied files.  Furthermore, atleast for small to moderately sized projects, the easiest thing to do is tohave all of the files collected in one place (i.e directory). This poses thefewest build management and portability headaches.</body><!-- Mirrored from c-faq.com/cpp/inclk.kaz.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 08:00:34 GMT --></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -