include path question


Subject: include path question
From: Mike Nordell (tamlin@algonet.se)
Date: Sat Jan 27 2001 - 19:02:49 CST


I know that neither the C nor the C++ standard doesn't say this, but *all*
compilers I've used have looked in the current directory first when they've
encountered
  #include "foo.h"
and in the INCLUDE environment variable path first when they encountered
  #include <foo.h>

I *think* that the "current directory" mentioned above is the directory
where this particular file lives (e.g. a header files in x/y/z first checks
the x/y/z dir. before anything else).

There might be compilers that behaves in another way. Do you know of a
(real, not imaginary or non-hierarchical file system) compiler that behaves
in another way?

What do you think is the correct behaviour of a completely autonomous src
package in this sense? Should its files (src or .h) try to include *it's*
include files that are put in another directory by
  #include "mess_me_up.h"
or should they use
  #include "../include/mess_me_up.h"

This is not just a rethorical question, this is a real problem I'm facing
again and I'd like to know AW developers opinion on what *you* think is the
correct behaviour, not from "this is the way it has always been done" but
what your common sense tells you.

/Mike - please, please, don't cc



This archive was generated by hypermail 2b25 : Sat Jan 27 2001 - 19:02:12 CST