home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16934 < prev    next >
Encoding:
Text File  |  1992-11-20  |  2.3 KB  |  49 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!att!dptg!ulysses!ulysses.att.com!gsf
  3. From: gsf@ulysses.att.com (Glenn S. Fowler)
  4. Subject: Re: Include file directory search path
  5. Message-ID: <1992Nov21.033034.12368@ulysses.att.com>
  6. Date: Sat, 21 Nov 1992 03:30:34 GMT
  7. References: <SIM.92Nov18151448@mdtf14.fnal.gov> <1992Nov19.171758.14067@eagercon.com>
  8. Organization: AT&T Bell Labs
  9. Lines: 38
  10.  
  11. In article <1992Nov19.171758.14067@eagercon.com> eager@eagercon.com writes:
  12. >In article 92Nov18151448@mdtf14.fnal.gov, sim@mdtf14.fnal.gov (Jim Sim) writes:
  13. >>Is there a way to force the C preprocessor to use the same search path to
  14. >>locate nested include files (files included by another include file) 
  15. >>that it uses to locate non-nested include files. My motivation for doing 
  16. >>this is to allow developers to make "test" changes to nested include files 
  17. >>that don't affect "official" versions of those include files.
  18. >
  19. >The compiler uses the same directory search path for all included files.
  20.  
  21. true if all includes are <...>
  22. "..." include searching, however, is up to the compiler implementation
  23. there are two popular "..." include search styles
  24.  
  25. 1) K&R: first check the current directory, then the <...> directories,
  26.    where the current directory is usually the directory of the top level
  27.    source file
  28. 2) "Reiser" (the traditional standalone UNIX cpp): first check the directory
  29.    of the including file, then the <...> directories
  30.  
  31. there is no standard "..." include style
  32. ANSI C leaves it as implementation-defined
  33.  
  34. 1 & 2 cause trouble in the case mentioned above -- for most C compilers
  35. it is impossible to override a nested "..." include from a local dir
  36.  
  37. AT&T does a lot a viewpathing, so this situation is not acceptable
  38. our local cpp accepts the option -I- that treats all includes as <...>
  39. to avoid the problem -- note, however, that using -I- may require
  40. additional -I dirs, e.g., for a "sys/foo.h" in -Ixxx that includes "sys/bar.h"
  41. as "bar.h" (using 2 above), an additional -Ixxx/sys is required
  42. our local make generates the -I options, so we avoid most of the
  43. -I maintenance problems
  44.  
  45. GNU cc picked up -I- a few years back
  46.  
  47. Glenn Fowler    (908)-582-2195    AT&T Bell Laboratories, Murray Hill, NJ
  48. uucp: {att,ucbvax}!ulysses!gsf              internet: gsf@ulysses.att.com
  49.