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

Avoid using namespace in Header Files #114

Open
TimmRuppert opened this issue Oct 11, 2024 · 0 comments · May be fixed by #115
Open

Avoid using namespace in Header Files #114

TimmRuppert opened this issue Oct 11, 2024 · 0 comments · May be fixed by #115
Assignees
Labels
quality Quality improvements.

Comments

@TimmRuppert
Copy link

The use of using namespace xyz in header files is generally discouraged. In this project, it is currently present in the example files:

Including using namespace in a header file can lead to unintended namespace pollution throughout the entire codebase, or even affect other projects that include the header. This practice can cause naming conflicts, such as having the same function defined more than once in the global namespace, leading to hard-to-debug issues.

Other people are way better at explaining this than I am:

While the affected files are only examples, they may be used as templates by others. For instance, all OSMP-related functions in openMSL appear to be based on this code. This makes it important to ensure that best practices are followed, even in example code.

Suggested Fix
Remove the using namespace directive from the header files and, if necessary, use fully qualified names or place the directive within implementation files.

@TimmRuppert TimmRuppert added the feature request Proposals which enhance the interface or add additional features. label Oct 11, 2024
@TimmRuppert TimmRuppert self-assigned this Oct 11, 2024
@TimmRuppert TimmRuppert added quality Quality improvements. and removed feature request Proposals which enhance the interface or add additional features. labels Oct 11, 2024
@TimmRuppert TimmRuppert linked a pull request Oct 11, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality Quality improvements.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant