Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: source for included included files
Message-ID: <1989Sep10.005745.23684@utzoo.uucp>
Organization: U of Toronto Zoology
References: <9275@cbnews.ATT.COM> <14172@bloom-beacon.MIT.EDU>
Date: Sun, 10 Sep 89 00:57:45 GMT

In article <14172@bloom-beacon.MIT.EDU> scs@adam.pika.mit.edu (Steve Summit) writes:
>... It is a not-universally-known and possibly surprising fact
>that #include with double quotes searches in the directory of the
>file doing the #including, not (necessarily) in the current
>directory from which the compiler was invoked.

One reason why it isn't universally known is that it's not universally true.

>... The ANSI
>standard says, according to K&R II (sec. A12.4), that "a control
>line of the form
>
>	#include "filename"
>
>searches first in association with the original source file (a
>deliberately implementation-dependent phrase)" ...

Beware, this is one respect in which K&R2 is outdated.  The Oct 88 draft,
more or less definitive, just says "searches in an implementation-defined
manner".  This is an area where implementations differ, partly because
the two major oracles -- K&R1 and the Unix cpp -- disagree.
-- 
V7 /bin/mail source: 554 lines.|     Henry Spencer at U of Toronto Zoology
1989 X.400 specs: 2200+ pages. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
