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

Contradiction between C++ styleguide and cpplint regarding transitive includes #757

Open
geoffviola opened this issue Jan 29, 2023 · 1 comment

Comments

@geoffviola
Copy link

This issue comes from cpplint#218

The Google C++ Style Guide states that

Do not rely on transitive inclusions. This allows people to remove no-longer-needed #include statements from their headers without breaking clients. This also applies to related headers - foo.cc should include bar.h if it uses a symbol from it even if foo.h includes bar.h.

The second part about including the direct dependencies in the source file regardless of the corresponding header, contradicts with cpplint. When cpplint is run on a source file, it counts the includes in its corresponding header file as included.

The policy is that if you #include something in foo.h you don't need to
include it again in foo.cc. Here, we will look at possible includes.

Which rule should be followed?

@tituswinters
Copy link
Contributor

tituswinters commented Jan 30, 2023 via email

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