introduce RMW_EVENT_TYPE_MAX in rmw_event_type_t.#518
Conversation
fujitatomoya
left a comment
There was a problem hiding this comment.
reference why we change this: ros2/rmw#380 (comment)
|
Pulls: ros2/rmw#380, ros2/rmw_fastrtps#785, ros2/rmw_connextdds#162, #518 |
|
Pulls: ros2/rmw#380, ros2/rmw_fastrtps#785, ros2/rmw_connextdds#162, #518 |
eboasson
left a comment
There was a problem hiding this comment.
Hi @fujitatomoya ! It is fine as it is but there is one thing I would do slightly differently: I would either also add it to rmw_take_event to maintain the pattern, or I would remove RMW_EVENT_INVALID there because init_rmw_event can never produce an rmw_event_t with that event type.
I don't like defaults in switches over enums, precisely because it prevents the compiler from helping me checking all relevant locations. I'm pretty sure if the default: unreachable wasn't present in rmw_take_event, you'd have added a case there, too 🙂
So I lean towards the former of my two suggestions, add RMW_EVENT_TYPE_MAX, and then also drop the unnecessary default case.
That said, there are more of those defaults ... Process-wise, dropping those unnecessary defaults might be better done in a separate PR. What do you think?
so true. i would have added a case there...
agree.
agree too. thanks! |
|
Pulls: ros2/rmw#380, ros2/rmw_fastrtps#785, ros2/rmw_connextdds#162, #518 |
|
Pulls: ros2/rmw#380, ros2/rmw_fastrtps#785, ros2/rmw_connextdds#162, #518 |
|
Pulls: ros2/rmw#380, ros2/rmw_fastrtps#785, ros2/rmw_connextdds#162, #518 |
|
@eboasson thanks for the review, CI is all green so just waiting for ros2/rmw#380 lgtm. |
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
59b391f to
b6b8247
Compare
|
Pulls: ros2/rmw#380, ros2/rmw_connextdds#162, ros2/rmw_fastrtps#785, #518 |
depends on ros2/rmw#380