Skip to content

Conversation

@jacobperron
Copy link
Contributor

jacobperron added a commit to ros2/rviz that referenced this pull request Sep 13, 2019
@jacobperron
Copy link
Contributor Author

Debug:

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

Copy link
Member

@cottsay cottsay left a comment

Choose a reason for hiding this comment

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

CI looks great - thanks for the quick fix!

@dirk-thomas
Copy link
Contributor

Doesn't this change API and require existing code to be updated (when ported to ROS 2)? Wouldn't it be another option to undefine the macros on Windows?

@jacobperron
Copy link
Contributor Author

Doesn't this change API and require existing code to be updated (when ported to ROS 2)? Wouldn't it be another option to undefine the macros on Windows?

The API was already changed in #44. For example, instead of OK in ROS 1, it was changed to INFO (and now STATUS_INFO).

State state variables aren't exposed in ROS 1, were only exposed for testing purposes in ROS 2.

@jacobperron
Copy link
Contributor Author

That being said, I'm also open to undefining the troublesome Windows macros if there's a better argument for that.

Copy link
Contributor

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

Sounds good to me then.

@jacobperron jacobperron merged commit be44924 into ros2 Sep 13, 2019
jacobperron added a commit to ros2/rviz that referenced this pull request Sep 13, 2019
@jacobperron jacobperron deleted the jacob/rename_enums branch September 13, 2019 20:25
@david-vay
Copy link

These should probably be enum classes.

@jacobperron
Copy link
Contributor Author

These should probably be enum classes.

Not a bad idea. But I don't think it resolves the clash we had with MSVC since it was caused by the preprocessor.

@david-vay
Copy link

Not a bad idea. But I don't think it resolves the clash we had with MSVC since it was caused by the preprocessor.

It should resolve that as well, since the names in an enum class are in their own namespace i.e.

  enum class Status : uint8_t
  {
    DEBUG = 0,
    INFO,
    WARN,
    ERROR
  };

  void f() {
    Status s1 = Status::INFO;
    Status s2 = INFO; // This will not compile
  }

@jacobperron
Copy link
Contributor Author

🤔

I think it would still fail at the declaration:

  enum class Status : uint8_t
  {
    DEBUG = 0,  // This is clash with MSVC DEBUG macro
    INFO,
    WARN,
    ERROR  // This will also clash
  };

Just a guess, I haven't tried.

@dgossow
Copy link
Member

dgossow commented Sep 19, 2019

you're right, that would be a problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants