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

#define PAL overrides namespace projectNamespace::PAL #1250

Open
pablo-msft opened this issue Mar 14, 2024 · 1 comment
Open

#define PAL overrides namespace projectNamespace::PAL #1250

pablo-msft opened this issue Mar 14, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@pablo-msft
Copy link

pablo-msft commented Mar 14, 2024

Problem line: https://github.com/microsoft/cpp_client_telemetry/blame/5068a981e2dc6ebe935e3184c011a1d8edfd6e8a/lib/include/public/ctmacros.hpp#L11

In our project, we have code like:

namespace projectName::PAL {
    class Object {};
}

namespace projectName {
    PAL::Object; // or projectName::PAL::Object - exact same compiler error message
}

When I #include LogManager.hpp, the compiler reports:

error C2039: 'Object': is not a member of 'Microsoft::Applications::Events::PlatformAbstraction'

This telemetry library should try to avoid global namespace conflicts, of which PAL is one, by appending a prefix like MAT_PAL or similar. Additionally, the library should additionally shy away from utilizing macros as namespaces, such as with PAL::getUtcSystemTimeMs() in the library code.

@pablo-msft pablo-msft added build infra Build, test and CI bug Something isn't working and removed build infra Build, test and CI labels Mar 14, 2024
@lalitb lalitb self-assigned this Mar 26, 2024
@lalitb
Copy link
Contributor

lalitb commented Mar 26, 2024

@pablo-msft Your concerns are valid, unfortunately this is the baggage we have from the legacy implementation, and it can't be changed at this time. As of now, your can undef the macro, or preserve the old PAL macro definition at the place of conflict, and revert afterwards. Let us know if you have further comments ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants