Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: Question about "#line"
Message-ID: <1990Oct18.165143.15463@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <656176474@romeo.cs.duke.edu>
Date: Thu, 18 Oct 90 16:51:43 GMT

In article <656176474@romeo.cs.duke.edu> drh@duke.cs.duke.edu (D. Richard Hipp) writes:
>   #line 40 "../another_dir/xyzzy.c"
>   #include "incl.h"
>
>After some experimentation, I've determined that GCC is trying to include
>the file named "../another_dir/incl.h", not "./incl.h" as I want...
>... PCC does not exhibit this behavior ...
>Which one is correct?  GCC or PCC.  The PCC version makes the most sense
>(to me) but I don't know what ANSI says...

ANSI says that the #include search procedure is implementation-defined.
Sigh.  (Bear in mind that ANSI C has no notion of "directory" at all.)

The GCC approach would seem closer to the intent of the standard.  By
the looks of it, #line changes PCC's error messages but does not affect
PCC's idea of where the file "really is" for #include search purposes.
ANSI C just says that #line "changes the presumed name of the source
file".  In the absence of further qualification, I'd interpret that as
changing it for all purposes, not just some.
-- 
"...the i860 is a wonderful source     | Henry Spencer at U of Toronto Zoology
of thesis topics."    --Preston Briggs |  henry@zoo.toronto.edu   utzoo!henry
