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

No windows.h in header files #118

Merged
merged 8 commits into from
Jan 12, 2021
Merged

No windows.h in header files #118

merged 8 commits into from
Jan 12, 2021

Conversation

ivanpauno
Copy link
Member

windows.h should not be included in any header file because it bizarrely pollutes the global namespace with macros that can easily collide with other names.

My favorites: min, max, ERROR, NO_ERROR, and even more.

IMO trying to make all our headers compatible with windows.h is a bit hopeless, so we should avoid including windows.h in header files and use custom workarounds in source files when appropriate (an #undef or #define NOMINMAX usually fix collisions).

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
@ivanpauno ivanpauno added the enhancement New feature or request label Jan 11, 2021
@ivanpauno ivanpauno self-assigned this Jan 11, 2021
@ivanpauno
Copy link
Member Author

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

This is fantastic, and exactly what we need. Thanks for doing this!

I have two nits inline. Also, I'm wondering if we should just move the implementation of the constructor that takes a std::string into the C++ file as well. It is minor, but putting it there helps on compile times, and just makes it so all of the implementation is in one place.

src/filesystem_helper.cpp Show resolved Hide resolved
src/filesystem_helper.cpp Outdated Show resolved Hide resolved
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
@ivanpauno
Copy link
Member Author

I'm wondering if we should just move the implementation of the constructor that takes a std::string into the C++ file as well

Moved all method and free function definitions to the source file in 82a0901.

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Looks good with green CI.

@ivanpauno
Copy link
Member Author

CI (build everything, test rcpputils):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@ivanpauno
Copy link
Member Author

Same jobs also including ros2/rosbag2#600:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@ivanpauno
Copy link
Member Author

Windows once again, also testing ros2/rcl_logging#71:

  • Windows Build Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants