Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
greg-minshall opened this issue Sep 19, 2024 · 1 comment

Comments

@greg-minshall
Copy link

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.

@glouw
Copy link
Owner

glouw commented Sep 21, 2024

Seems fine to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants