Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-8579

QSharedDataPointer documentation includes superfluous example code

    XMLWordPrintable

Details

    Description

      In QSharedDataPointer documentation, there is an example code as follows,

      class EmployeeData : public QSharedData
      {
      public:
      EmployeeData() : id(-1)

      { name.clear(); }

      EmployeeData(const EmployeeData &other)
      : QSharedData(other), id(other.id), name(other.name) { }
      ~EmployeeData() { }

      int id;
      QString name;
      };

      Am I correct to assume that the name.clear() call in the default constructor is completely and utterly superfluous? The destructor is also not needed.

      This relatively minor bug makes this part of the documentation more difficult to read. Ever after wiring Qt software for some time now, I was somewhat confused by the "necessity" of using clear() on a null QString.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            docteam Qt Documentation Team
            adamm Adam Majer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes