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

to avoid using namespace at global scope #717

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

offspring
Copy link
Contributor

@offspring offspring commented Aug 2, 2024

adding using directive in header files is not a good idea, with this PR

this code

            if(!config.containsKey(str)) {
                debugE("N2kFluidLevelSender: Missing configuration key %s",
                       str.c_str());
                return false;
            }

will not require

using namespace sensesp;`

in the include files

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf7-dont-write-using-namespace-at-global-scope-in-a-header-file

adding using directive in header files is not a good idea, with this PR
this code
```cpp
            if(!config.containsKey(str)) {
                debugE("N2kFluidLevelSender: Missing configuration key %s",
                       str.c_str());
                return false;
            }

```
will not require
```cpp
using namespace sensesp;`
```
in the include files

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf7-dont-write-using-namespace-at-global-scope-in-a-header-file
@mairas
Copy link
Collaborator

mairas commented Aug 2, 2024

Good catch!

In the dev-3 codebase, I've taken a bit different approach with the logging/debugging macros: ESP-IDF native ESP_LOGx macros are used as is. The debugX macros are still provided for backwards compatibility - and actually, most of the codebase still uses them. Probably should do a cleanup before the release.

It would be great if you'd have time to do a similar PR against the dev-3 branch as well. But if not, that's OK, the change is pretty simple.

@mairas mairas merged commit 3352e88 into SignalK:main Aug 13, 2024
14 checks passed
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

Successfully merging this pull request may close these issues.

2 participants