This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

exclusively includes


My few comments on rights and wrongs in includes.

In the header files libguile/*.h that include __scm.h the line:

#include "libguile/__scm.h"

is wrong since a user program including the system header would never
have a libguile directory under it's own tree and neither is there
a ./libguile/libguile/__scm.h anywhere. There are two right ways to
do it which are either:

#include <libguile/__scm.h>

or perhaps:

#include "__scm.h"

It is arguable which one is more right but probably the majority
of people would go with the angle brackets because that is the way
the system headers do it. For example, sys/ioctl.h includes
another file from the same directory like so:

#include <sys/ttydefaults.h>

When compiling up libguile itself, using <libguile/__scm.h> or
"libguile/__scm.h" both depend on the -I.. compiler option which is
perhaps a little bit unclean but it seems like the standard strategy
and it works OK, might as well keep things as standard as possible
and try to make the guile headers use the same techniques as the system
headers.

Another include thingy that I couldn't help noticing is the line:

#include <gh.h>

That appears in the various files libguile/gh_*.c
This one should be the other way around, using double quotes because
firstly, if you are using the system headers (as you might for an
application program) then it would be:

#include <guile/gh.h>

But files such as libguile/gh_init.c are NOT supposed to be using
the system libraries for what they themselves are defining. The
correct way to include these is to use:

#include "gh.h"

Because this guarantees that the include is coming from the local
directory and that is where you would expect it to come from.
It avoids the need for the (somewhat strange IMHO) -I. option.

	- Tel