[ 
https://issues.apache.org/jira/browse/STDCXX-907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594273#action_12594273
 ] 

Martin Sebor commented on STDCXX-907:
-------------------------------------

I'm wondering if {{__rw_get_message()}} is actually exposed in the library's 
ABI given that the facet template has only two possible specializations and 
they are both instantiated in the library. If not, we could make the change 
without keeping the old signature around.

Btw., I'm not sure using the version macro this way is the best approach for 
the library (then again, I'm not sure it isn't, either). Would adding an 
{{#else}} block along these lines be a better way of guaranteeing that the code 
does in fact get removed?
{noformat}
#else
#  error "remove me!"
#endif
{noformat}

As for the signature of the new overload, FWIW, my personal preference is for 
the convention where objects are passed by reference as ??in?? parameters and 
by their address as ??out?? parameters. That way it's usually more clear at the 
call site that the object will be modified. I.e.,
{noformat}
@@ -61,16 +61,20 @@
                           int                    __msgid,
                           const string_type     &__dfault) const
 {
-    const char* const __text = _RW::__rw_get_message (__cat, __set, __msgid);
- 
+    const _STD::locale* __ploc;   // will be set in __rw_get_message()
+
+    const char* const __text = _RW::__rw_get_message (__cat, __set, __msgid, 
&__ploc);
     if (__text) {
{noformat}


> messages<charT>::do_get() inefficiency requires unnecessary locking
> -------------------------------------------------------------------
>
>                 Key: STDCXX-907
>                 URL: https://issues.apache.org/jira/browse/STDCXX-907
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.2.1
>            Reporter: Travis Vitek
>            Assignee: Travis Vitek
>            Priority: Minor
>             Fix For: 4.3
>
>         Attachments: stdcxx-907.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The {{_STD::messages<T>::do_get()}} method might actually call 
> {{\_\_rw_manage_cat_data()}} up to three times to access the cache. Since 
> each access involves a mutex lock, there are going to be some wasted cycles. 
> It would be nice to reduce this to one access. Perhaps the 
> {{_RW::\_\_rw_get_message()}} function could be changed to fill in a pointer 
> to the {{_STD::locale}} that is kept in the cache and the 
> {{_RW::\_\_rw_get_locale()}} function could be removed.
> For backward binary compatibility we would need to keep the existing 
> functions around, but we could add an overload and then deprecate the old 
> ones using the {{_RWSTD_VER}} macro.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to