Skip to content

No windows.h in header files#118

Merged
ivanpauno merged 8 commits intomasterfrom
ivanpauno/no-windows-h
Jan 12, 2021
Merged

No windows.h in header files#118
ivanpauno merged 8 commits intomasterfrom
ivanpauno/no-windows-h

Conversation

@ivanpauno
Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

Copy link
Copy Markdown
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.

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

CI (build everything, test rcpputils):

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

@ivanpauno
Copy link
Copy Markdown
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
Copy Markdown
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