Skip to content

Use #include "..." instead of #include <...> to include internal #71

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

Closed
kmyk opened this issue Nov 10, 2020 · 2 comments
Closed

Use #include "..." instead of #include <...> to include internal #71

kmyk opened this issue Nov 10, 2020 · 2 comments

Comments

@kmyk
Copy link

kmyk commented Nov 10, 2020

To include headers from other headers in the same library, we should use #include "...". This is a common manner (examples: 1, 2, 3).

However, the current AtCoder Library uses #include <...> (e.g. https://github.com/atcoder/ac-library/blob/114e690ade7fe839db3ea0e5f169207672ef0886/atcoder/all).
#include <...> is for headers in the standard system directories (see https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html), but AtCoder Library is not system's one.

IIUC, if you use #include <...>, a problem will happen when multiple versions of the this library are installed.
For example, let say we have /usr/include/atcoder/segtree.hpp, /home/user/kimiyuki/GitHub/ac-library/atcoder/segtree.hpp, and /home/user/kimiyuki/GitHub/ac-library/atcoder/all. Under such situation, even when you include /home/user/kimiyuki/GitHub/ac-library/atcoder/all with #include "atcoder/all", this atcoder/all ignores /home/user/kimiyuki/GitHub/ac-library/atcoder/segtree.hpp and includes /usr/include/atcoder/segtree.hpp. This will cause mysterious bugs.

@kmyk
Copy link
Author

kmyk commented Nov 10, 2020

BTW, the motivation of this issue is at online-judge-tools/verification-helper#345, which is an issue about the combination of our oj-bundle command and AtCoder Library.

@yosupo06
Copy link
Collaborator

Ah, your indication make sense. We don't have any strong opinion whether #include <...> or #include "...". We'll fix this.

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