🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1097

Re: #include "filename.h" does not mean "include user file"

#1097
From: Eduardo Krell
Date: Fri, 16 Mar 1990 04:14
26 lines
1794 bytes
I'm the one who originally implemented the '-I-' flag for gcc-cpp. The
wording I gave FSF is different from the one that appears in the manual
(which is wrong, as you point out).

>    In addition, the '-I-' option inhibits the use of the current directory
>    as the first search directory for '#include "file"'.  Therefore, the
>    current directory is searched only if it is requested explicitly with
>    '-I.'.  Specifying both '-I-' and '-I.' allows you to control precisely
>    which directories are searched before the current one and which are
>    searched after."

What '-I-' does is supress the search in the directory where the including
file is (the file with the #include statement), NOT the current directory.

This is needed because there's no way to override the search in that
directory, which comes first for header files included with "". For
instance, you #include <foo.h>. Inside foo.h there's a #include "bar.h"
which is in the same directory foo.h is.
If you want to use your own bar.h so that it's included by foo.h, there's no
way of doing that since -I. would NOT take precedence over searching
in the same directory where foo.h is. That's the reason why -I-
is needed.
    
Eduardo Krell                   AT&T Bell Laboratories, Murray Hill, NJ

UUCP: {att,decvax,ucbvax}!ulysses!ekrell  Internet: ekrell@ulysses.att.com
Technical Details
Message-ID: <12691@ulysses.att.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!ulysses!ulysses.att.com!ekrell
References: <6928@cadillac.CAD.MCC.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!ulysses!ulysses.att.com!ekrell
From: ekrell@ulysses.att.com (Eduardo Krell)
Newsgroups: comp.std.c
Subject: Re: #include "filename.h" does not mean "include user file"
Keywords: include
Message-ID: <12691@ulysses.att.com>
Date: 16 Mar 90 04:14:01 GMT
References: <6928@cadillac.CAD.MCC.COM>
Sender: netnews@ulysses.att.com
Organization: AT&T Bell Labs
Lines: 26