jovany-wang 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_r249439238
########## 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: @ifplusor Thanks, I see. So if the method may be return a temp variable, it is pretty make sense to declare it as `string MQMessage::getProperty(const string& name);`. If the method always return his member variables, we could return a const ref. ---------------------------------------------------------------- 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
