Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-443

Return by const reference in Logger::getName()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.11.0
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            ulerich Rhys Ulerich
            ulerich Rhys Ulerich
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: