Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Do not include windows.h in statemap.hpp #109

Merged
merged 2 commits into from
Jan 23, 2025
Merged

Conversation

traversaro
Copy link
Contributor

Including windows.h in a public header may screw up any call to std::min, std::max or any enum called ERROR (that are quite frequent). Apparently this specific include is unused (see #46) so we can safely remove it.

@@ -52,7 +52,6 @@
#endif // SMC_NO_EXCEPTIONS
#include <cstdio>
#elif defined(WIN32)
#include <windows.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know your point is only to fix the Windows problem, but I kind of feel like this nest of ifdefs can be replaced by:

#if defined(SMC_NO_EXCEPTIONS)
#include <cassert>
#include <cstdio>
#else
#include <cstring>
#include <stdexcept>
#endif

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I did not actually check the code context, I implemented the suggested solution in 0a2720b .

@clalancette clalancette merged commit cad72f7 into ros:ros2 Jan 23, 2025
3 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants