You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
The use of
using namespace xyz
in header files is generally discouraged. In this project, it is currently present in the example files:osi-sensor-model-packaging/examples/OSMPDummySource/OSMPDummySource.h
Line 13 in 961f01a
osi-sensor-model-packaging/examples/OSMPDummySource/OSMPDummySource.h
Line 13 in 961f01a
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.
The text was updated successfully, but these errors were encountered: