Liste des Groupes | Revenir à cl c |
David Brown <david.brown@hesbynett.no> writes:Yes, after reading your expanded explanation, I agree with you here (both parts). Thanks for that clarification.On 13/03/2024 16:15, Keith Thompson wrote:I believe that's consistent with what I wrote, though I probably wasn'tMichael S <already5chosen@yahoo.com> writes:>
[...]I just tried three compilers and [in absence of -I options] all 3 workAccording to the GNU cpp manual, the "-I" option prepends
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.
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.
clear enough.
To expand on it:
There are two lists of locations (typically directories). Let's call
them the <>-list (described in N1570 6.10.2p2) and the ""-list
(described in N1570 6.10.2p3).
#include <foo.h> searches the <>-list.
#include "foo.h" searches the ""-list; if that fails, it then searches
the <>-list as if for #include <foo.h>.
The -I option prepends directories to the <>-list, which means it
affects both #include <foo.h> and #include "foo.h". But for
#include "foo.h", a foo.h file in the same directory as the including
file will always be found first if it exists.
[...]
The complete description is here:[...]
<https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html>.
[slightly reformatting quoted text]1. For the quote form of the include directive, the directory ofWhat I called the ""-list is described in steps 1-2.
the current file is searched first.
>
2. 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.
>
3. Directories specified with -I options are scanned in
left-to-right order.
>
4. Directories specified with -isystem options are scanned in
left-to-right order.
>
5. Standard system directories are scanned.
>
6. Directories specified with -idirafter options are scanned in
left-to-right order.
What I called the <>-list is described in steps 3-6.
[...]
Les messages affichés proviennent d'usenet.