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

[Bug] using namespace in header file #3088

Open
2 tasks done
r-barnes opened this issue Apr 18, 2024 · 0 comments
Open
2 tasks done

[Bug] using namespace in header file #3088

r-barnes opened this issue Apr 18, 2024 · 0 comments

Comments

@r-barnes
Copy link

Prerequisite

Environment

LLVM 15 with -Wheader-hygiene enabled on a project including MMCV.

Reproduces the problem - code sample

I don't have a direct reproducer since I'm on a custom build system, but compiling with -Wheader-hygiene enabled would reproduce the issue.

Reproduces the problem - command or script

N/A

Reproduces the problem - error message

N/A

Additional information

This line puts at in the global namespace:

using namespace at;

this is universally considered a bad practice since it pollutes the namespace for any file including a given header.

In an attempt to reduce this practice in a large codebase, I am enabling -Wheader-hygiene. This breaks for MMCV because of the line above.

If we can remove that line and either use at::Tensor as appropriate or using namespace at; in the implementation (cpp) files, that would solve the problem and align with best practices.

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

1 participant