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

Macro U collides with Armadillo #812

Closed
SanPen opened this issue Jul 19, 2018 · 5 comments
Closed

Macro U collides with Armadillo #812

SanPen opened this issue Jul 19, 2018 · 5 comments

Comments

@SanPen
Copy link

@SanPen SanPen commented Jul 19, 2018

The macro #define U(x) _XPLATSTR(x) collides somehow with the linear algebra library Armadillo.

If I rename the macro, it all works.

I think it is worth mentioning.

@aksswami
Copy link

@aksswami aksswami commented Jul 24, 2018

@SanPen You can add a compiler flag TURN_OFF_PLATFORM_STRING as suggested by code comment.

@d-frey
Copy link

@d-frey d-frey commented Jul 31, 2018

U is a really bad name, a user of our library was also using cpprestsdk and we used U as the name of a template parameter, think template< typename T, typename U >. Later we used U as a return type for a function pointer, something like using func_t = U(*)(int,int); - and that didn't work because of the macro U. Please stop defining macros with extremely common names.

@damienhocking
Copy link

@damienhocking damienhocking commented Jul 31, 2018

@SanPen
Copy link
Author

@SanPen SanPen commented Aug 1, 2018

Exactly, I also changed it to USTR, but whenever I update the code or someone else downloads cpprestskd to use it with my code, they have to rename the macro as well.

So, it would be very helpfull to rename this macro (and potentially others) to something harder to be used by others.

@ras0219-msft
Copy link
Contributor

@ras0219-msft ras0219-msft commented Aug 1, 2018

We completely agree that U(X) is an inappropriate macro; however changing it would be enormously breaking for existing code -- something we certainly won't do between major versions.

The correct mechanism to address this problem is what @aksswami has suggested: define TURN_OFF_PLATFORM_STRING and use _XPLATSTR in your own code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.