geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-3288) Replace char* with std::string
Date Wed, 29 Nov 2017 18:19:00 GMT

    [ https://issues.apache.org/jira/browse/GEODE-3288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16271281#comment-16271281
] 

ASF GitHub Bot commented on GEODE-3288:
---------------------------------------

pivotal-jbarrett commented on a change in pull request #160: GEODE-3288: Converts char* to
std::string on public API.
URL: https://github.com/apache/geode-native/pull/160#discussion_r153871879
 
 

 ##########
 File path: cppcache/include/geode/CacheAttributes.hpp
 ##########
 @@ -80,17 +82,16 @@ class CPPCACHE_EXPORT CacheAttributes {
   /** Sets cache level endpoints list.
    *
    */
-  void setEndpoints(char* endpoints);
+  void setEndpoints(const std::string& endpoints);
+  void setEndpoints(std::string&& endpoints);
 
 Review comment:
   I think I was experimenting here. I should back it out. We can always add it later.
   
   ```void setEndpoints(const std::string& endpoints);```
   Does not result in a copy to make the call but since internally we keep it a copy is made.
No optimization can be made but none is really necessary unless the param is an r-value. The
method also fails to communicate that we are keeping a copy.
   
   ```void setEndpoints(std::string endpoints);```
   Communicates we are keeping a copy as copy is don't on the call. Unoptimized the copy happens
also at the assignment to the member variable, though most modern compilers I believe will
optimize that second copy out.
   
   ```void setEndpoints(std::string&& endpoints);```
   Communicates a copy is kept and optimizes the r-value to avoid extra copies.
   
   The two methods implemented are consistent with what the container class templates generate
to handle l-values and r-values optimally. 

----------------------------------------------------------------
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:
users@infra.apache.org


> Replace char* with std::string
> ------------------------------
>
>                 Key: GEODE-3288
>                 URL: https://issues.apache.org/jira/browse/GEODE-3288
>             Project: Geode
>          Issue Type: Improvement
>          Components: native client
>            Reporter: Ernest Burghardt
>
> In all public API headers



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message