Field has_header is of trivial type and the no-arg constructor does not initialize it. This has hit me with a hard-to-debug issue when creating advertiseoptions myself not using the all-arg constructor. If you create AdvertiseOptions using the no-arg constructor, has_header gets a random value and the code path in Publication tries to increment the seq field even if the message does not have a header.
Would a PR adding the missing initializer be accepted in Melodic and Noetic? I think adding an initializer should not break ABI or API.
https://github.com/ros/ros_comm/blob/f1156c15a42482d5e762c9e7a2a307681a00adcf/clients/roscpp/include/ros/advertise_options.h#L43-L47
https://github.com/ros/ros_comm/blob/f1156c15a42482d5e762c9e7a2a307681a00adcf/clients/roscpp/include/ros/advertise_options.h#L131
Field
has_header
is of trivial type and the no-arg constructor does not initialize it. This has hit me with a hard-to-debug issue when creating advertiseoptions myself not using the all-arg constructor. If you createAdvertiseOptions
using the no-arg constructor,has_header
gets a random value and the code path inPublication
tries to increment theseq
field even if the message does not have a header.Would a PR adding the missing initializer be accepted in Melodic and Noetic? I think adding an initializer should not break ABI or API.