You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by "Rhys Ulerich (JIRA)" <lo...@logging.apache.org> on 2014/10/21 02:20:34 UTC

[jira] [Created] (LOGCXX-443) Return by const reference in Logger::getName()

Rhys Ulerich created LOGCXX-443:
-----------------------------------

             Summary: Return by const reference in Logger::getName()
                 Key: LOGCXX-443
                 URL: https://issues.apache.org/jira/browse/LOGCXX-443
             Project: Log4cxx
          Issue Type: Bug
            Reporter: Rhys Ulerich
            Assignee: Rhys Ulerich
            Priority: Minor


Any one know why

    const LogString Logger::getName() const { return name; }

within src/main/include/log4cxx/logger.h doesn't return a const reference a la

    const LogString& Logger::getName() const { return name; }

In src/main/include/log4cxx/logstring.h the typedef is just

    typedef std::basic_string<logchar> LogString

which makes me think getName() invocations do needless copying, and
callers are already not permitted to mutate the result.



Discussed at http://mail-archives.apache.org/mod_mbox/logging-log4cxx-dev/201403.mbox/%3CCAKDqugTe%2Byd9G2JyRm1fwZ_w3_RPO4mMWgmX9tTbzyk0i04oWA%40mail.gmail.com%3E.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)