0
$\begingroup$

Rosanswers logo

Hello, I am worried about the following warning that is given when compiling roscpp programs which contains a publisher:

/opt/ros/groovy/include/ros/publisher.h: In member function ‘void ros::Publisher::publish(const M&) const [with M = geometry_msgs::PoseStamped]’:
/opt/ros/groovy/include/ros/publisher.h:112: warning: comparison with string literal results in unspecified behaviour

The publisher:

ros::Publisher goalPub = this->n.advertise<geometry_msgs::PoseStamped>("move_base_simple/goal", 1);
geometry_msgs::PoseStamped msg;
msg.header.frame_id = "/map";
msg.header.stamp = ros::Time::now();
msg.pose.position.x=mygoal.x;
msg.pose.position.y=mygoal.y;
msg.pose.orientation=tf::createQuaternionMsgFromYaw(angle);
goalPub.publish(msg);

But the warning is given for all the publishers:

ros::Publisher cmdPub = this->n.advertise<geometry_msgs::Twist>("cmd_vel", 1);
cmdPub.publish(msg);

My machine is ubuntu 12.10 with the latest version of ros-groovy and gcc 4.4.7.

Is this warning dangeours? is it being adresses? is it considered a 'bug'? if so, where can I open a ticket for it?


Originally posted by Victor_ocv2 on ROS Answers with karma: 483 on 2013-02-01

Post score: 0


Original comments

Comment by joq on 2013-02-01:
Would you please add the code invoking publish(), by editing your question?

Comment by dornhege on 2013-02-01:
It might be that the compile gets more verbose about warnings with later versions, but are you sure you are using 4.4.7? On Oneiric I already have 4.6.1.

Comment by Victor_ocv2 on 2013-02-01:
Yes, I had to downgrade to able to compile something... (CUDA maybe?)

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I think you hit a bug in roscpp introduced 10 days ago. The const char * result of mt::md5sum<M>(message) is compared with the string literal "*" in publisher.h:112. The warning also appears in newer versions of gcc (like 4.6.3 in a standard Ubuntu precise installation).

Created a ticket: https://github.com/ros/ros_comm/issues/165.


Originally posted by Johannes Meyer with karma: 1266 on 2013-02-02

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by Victor_ocv2 on 2013-02-02:
Thank you!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.