home | list info | list archive | date index | thread index

[OCLUG-Tech] still confused about the use of (now obsolete) "-I-" option of gcc

  • Subject: [OCLUG-Tech] still confused about the use of (now obsolete) "-I-" option of gcc
  • From: "Robert P. J. Day" <rpjday [ at ] crashcourse [ dot ] ca>
  • Date: Thu, 31 Mar 2016 07:38:17 -0400 (EDT)
  i'm still trying to understand the *precise* mechanics of what
happens when one uses "-I-" to mangle the header file search path with
gcc. from the man page, it *seems* straight forward:

-I-

"Split the include path.  Any directories specified with -I options
before -I- are searched only for headers requested with "#include
"file""; they are not searched for "#include <file>".  If additional
directories are specified with -I options after the -I-, those
directories are searched for all #include directives.

"In addition, -I- inhibits the use of the directory of the current
file directory as the first search directory for "#include "file"".
This option has been deprecated."

but here's the part i'm still unclear on.

  as i understand it, the primary purpose of this option is to allow
the overriding of header files specified with quotes. normally, of
course, if you have:

  #include "rday.h"

the first place the preprocessor looks is in the current directory.
using "-I-" allows one to override that (which, IMHO, is a creepily
bad idea to begin with but ... whatever).

  now, according to the man page above, the directories specified
before -I- are effectively override directories for such includes --
that much i think i understand. and that second paragraph simply
reinforces that the current directory will *not* be used as the first
search location.

  but what isn't clear is whether the current directory will
*eventually* be searched. is it? if the quoted header file doesn't
exist in any of those "override" directories, will the local (current
directory) version be included? is it my imagination, or is that just
not clearly stated in the man page?

rday

p.s. can someone just reply to this email, to make sure my email is
working properly? weird things have been happening so i just want to
confirm things are getting out and being read. thank you kindly.

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================