Skip to content

for internal includes, use quote form rather than angle-bracket form? #25

@greg-minshall

Description

@greg-minshall

from my application, i like to, e.g., #include <ctl/str.h>, with a -I pointing at some directory that includes ctl/ as a sub-directory.

but, includes to other ctl files within the ctl/ directory use "angle-bracket form", which does not look first in the directory containing the file (e.g., str.h) doing the #include.

i think if these angle-bracket form includes were changed to quote form, i.e., if

#include <vec.h>

were changed to

#include "vec.h"

all would be happy? (probably there's a downside, though?)

for background, a relevant section of the GNU cpp info pages says

By default, the preprocessor looks for header files included by the
quote form of the directive ‘#include "FILE"’ first relative to the
directory of the current file, and then in a preconfigured list of
standard system directories.  For example, if ‘/usr/include/sys/stat.h’
contains ‘#include "types.h"’, GCC looks for ‘types.h’ first in
‘/usr/include/sys’, then in its usual search path.

   For the angle-bracket form ‘#include <FILE>’, the preprocessor's
default behavior is to look only in the standard system directories.

cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions