ifplusor commented on a change in pull request #73: [ISSUE #71]Fixed the issue that dangling reference returned when getting message property . URL: https://github.com/apache/rocketmq-client-cpp/pull/73#discussion_r249437363
########## File path: src/message/MQMessage.cpp ########## @@ -48,6 +48,9 @@ const string MQMessage::PROPERTY_TRANSACTION_CHECK_TIMES = "TRANSACTION_CHECK_TI const string MQMessage::PROPERTY_CHECK_IMMUNITY_TIME_IN_SECONDS = "CHECK_IMMUNITY_TIME_IN_SECONDS"; const string MQMessage::KEY_SEPARATOR = " "; + +static const string EMPTY_STRING = ""; Review comment: > If you don't want to move it to `constant.h`, let's use `return "";` directly? > Because I don't think we should use a global static variable in such case.:) @jovany-wang now, we return a reference, and return a temp object is a bug. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
