Skip to content

NAMESPACE_BEGIN macro redefinition #2199

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

Closed
Trigve opened this issue May 1, 2020 · 4 comments · Fixed by #2283
Closed

NAMESPACE_BEGIN macro redefinition #2199

Trigve opened this issue May 1, 2020 · 4 comments · Fixed by #2283

Comments

@Trigve
Copy link
Contributor

Trigve commented May 1, 2020

Issue description

The NAMESPACE_BEGIN is very generic name and therefor there could be the name clash (for instance CryptoPP does use the NAMESPACE_BEGIN also).

It could be fixed renaming the NAMESPACE_BEGIN -> PYBIND11_NAMESPACE_BEGIN. I think this is the only macro that hasn't the PYBIND11 prefix.

@noeffn
Copy link

noeffn commented Jun 30, 2020

Encountered this problem had to pretty much #undef NAMESPACE_BEGIN #undef NAMSPACE_END
before including pybind11

@wjakob
Copy link
Member

wjakob commented Jun 30, 2020

This change would be fine with me. Do you want to make a PR? FWIW, CryptoPP should probably also change its macro :-P

@YannickJadoul
Copy link
Collaborator

Funnily enough, pybind11 behaves quite polite here, checking if no one else already defined it:

#if !defined(NAMESPACE_BEGIN)
#  define NAMESPACE_BEGIN(name) namespace name {
#endif
#if !defined(NAMESPACE_END)
#  define NAMESPACE_END(name) }
#endif

@YannickJadoul
Copy link
Collaborator

But, see #2283.

lebarsfa added a commit to lebarsfa/codac that referenced this issue Apr 17, 2022
lebarsfa added a commit to lebarsfa/codac that referenced this issue Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants