C
Charles Mills
What does the C standard (C99) say about which version of header2.h
should be included in the following case - where directory1 is the
current directory and directory2 is included in the list of directories
to be searched for headers?
contents of directory1:
file1.c:
#include "file1.h"
int main(void) { return 0; }
-- EOF
file1.h:
#include "header1.h"
-- EOF
header2.h:
#warning ---> In directory1/header2.h
-- EOF
contents of directory2:
header1.h:
#include "header2.h"
-- EOF
header2.h:
#warning ---> In directory2/header2.h
-- EOF
Perhaps this is all implemtation defined... if it is what happens
typically in the real world? GCC gives
$ gcc -Iother file1.c
In file included from other/header1.h:1,
from file1.h:2,
from file1.c:2:
other/header2.h:1:2: warning: #warning ---> In other/header2.h
-Charlie
should be included in the following case - where directory1 is the
current directory and directory2 is included in the list of directories
to be searched for headers?
contents of directory1:
file1.c:
#include "file1.h"
int main(void) { return 0; }
-- EOF
file1.h:
#include "header1.h"
-- EOF
header2.h:
#warning ---> In directory1/header2.h
-- EOF
contents of directory2:
header1.h:
#include "header2.h"
-- EOF
header2.h:
#warning ---> In directory2/header2.h
-- EOF
Perhaps this is all implemtation defined... if it is what happens
typically in the real world? GCC gives
$ gcc -Iother file1.c
In file included from other/header1.h:1,
from file1.h:2,
from file1.c:2:
other/header2.h:1:2: warning: #warning ---> In other/header2.h
-Charlie