Deutsch   English   Français   Italiano  
<ussorq$12dc7$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: =?UTF-8?B?UmU6IFdvcmQgRm9yIFRvZGF5OiDigJxVZ2xpZmljYXRpb27igJ0=?=
Date: Wed, 13 Mar 2024 18:47:38 +0100
Organization: A noiseless patient Spider
Lines: 90
Message-ID: <ussorq$12dc7$1@dont-email.me>
References: <uso6or$3t3jn$3@dont-email.me> <usopec$4eob$1@dont-email.me>
 <usort1$4t2r$1@dont-email.me> <20240312003531.349@kylheku.com>
 <wwvwmq7x4ex.fsf@LkoBDZeT.terraraq.uk> <usp9m5$7it7$1@dont-email.me>
 <20240312174600.5b88613545da9f667e06a4c6@g{oogle}mail.com>
 <uspqa4$bfao$1@dont-email.me>
 <20240312180904.ac3a5856df424c396689db3e@g{oogle}mail.com>
 <uspt5n$c2bg$1@dont-email.me> <20240312114213.182@kylheku.com>
 <usql0p$hk2k$1@dont-email.me> <878r2n839m.fsf@nosuchdomain.example.com>
 <uss3kr$ud17$1@dont-email.me> <20240313141248.00003cbe@yahoo.com>
 <87frwu6u4j.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 13 Mar 2024 17:47:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="513c0e2a46e8e74a10594dc4b3e54834";
	logging-data="1127815"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+eXBs/DxSFI0IxhfT7vRCFbMs/2CQuv2M="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:92jCXhN0EAvpuXJr2+ZbFiHTRuU=
Content-Language: en-GB
In-Reply-To: <87frwu6u4j.fsf@nosuchdomain.example.com>
Bytes: 5413

On 13/03/2024 16:15, Keith Thompson wrote:
> Michael S <already5chosen@yahoo.com> writes:
> [...]
>> I just tried three compilers and [in absence of -I options] all 3 work
>> as expected, i.e. ignored stdio.h in current directory.
>> None of the three was of the variety that you appear to prefer.
>> Mine's are mundane stuff.
>>
>> However all three took local file when I had given them an option -I.
>> Not sure what to make of this. Whatever happens with
>> non-default options is probably in "implementation-defined"
>> domain as far as the C Standard is concerned, but I still
>> expected that such common option as  -I would not affect standard
>> headers.
> 
> According to the GNU cpp manual, the "-I" option prepends directories to
> the search path used for <> headers, and the "-iquote" option prepends
> directories to the search path used for "" headers.
> 
> I find that a bit surprising.

You are not quite correct - and I find /that/ a bit surprising!

The -I option applies equally to <...> and "..." headers.

>  I had never heard of the "-iquote"
> option.
> 

The complete description is here: 
<https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html>.  (It is the 
same in the cpp manual, but it is better to look at the compiler manual 
for this kind of thing - after all, the gcc driver program can pass 
different options to the cpp subprogram.)

To save people looking it up:



-I dir
-iquote dir
-isystem dir
-idirafter dir

     Add the directory dir to the list of directories to be searched for 
header files during preprocessing. If dir begins with ‘=’ or $SYSROOT, 
then the ‘=’ or $SYSROOT is replaced by the sysroot prefix; see 
--sysroot and -isysroot.

     Directories specified with -iquote apply only to the quote form of 
the directive, #include "file". Directories specified with -I, -isystem, 
or -idirafter apply to lookup for both the #include "file" and #include 
<file> directives.

     You can specify any number or combination of these options on the 
command line to search for header files in several directories. The 
lookup order is as follows:

         For the quote form of the include directive, the directory of 
the current file is searched first.
         For the quote form of the include directive, the directories 
specified by -iquote options are searched in left-to-right order, as 
they appear on the command line.
         Directories specified with -I options are scanned in 
left-to-right order.
         Directories specified with -isystem options are scanned in 
left-to-right order.
         Standard system directories are scanned.
         Directories specified with -idirafter options are scanned in 
left-to-right order.

     You can use -I to override a system header file, substituting your 
own version, since these directories are searched before the standard 
system header file directories. However, you should not use this option 
to add directories that contain vendor-supplied system header files; use 
-isystem for that.

     The -isystem and -idirafter options also mark the directory as a 
system directory, so that it gets the same special treatment that is 
applied to the standard system directories.

     If a standard system include directory, or a directory specified 
with -isystem, is also specified with -I, the -I option is ignored. The 
directory is still searched but as a system directory at its normal 
position in the system include chain. This is to ensure that GCC’s 
procedure to fix buggy system headers and the ordering for the 
#include_next directive are not inadvertently changed. If you really 
need to change the search order for system directories, use the 
-nostdinc and/or -isystem options.