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

= default'ed SFMs (+ default ctor) should be shown as defaulted in the Documentation

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.10.0 Beta4
    • Build tools: qdoc

      When a class or struct has defaulted SMFs (incl. the default ctor, and, eventually, relational operators), the = default should be shown in the docs (e.g. in the same position as currently noexcept, constexpr). This is important information that would be very hard (and repetitive) to convey in prose every time.

      Consider the Axis struct of https://codereview.qt-project.org/c/qt/qtbase/+/661028. If I don't \fn the default ctor, an astute reader will wonder whether the struct is default-constructible at all, given there's a (QVector3D) ctor that would, if this was the whole story, disable the default constructor of the struct.

      If I \fn the default-constructor, I need to go into a lot of details regarding the difference between value-construction and default construction, something that would be easily conveyed to the astute reader by listing the = default.

      If I try to dodge the issue by saying, in prose, that "this constructor is defaulted", astute readers may wonder what, exactly that means, until they figure out it's = default. OTOH, readers for which C++ is not their strong suit may wonder what that means, too. But instead of asking a senior what the = default means once, and then applying that to all the docs (and the source), they would have to parse each class' author's own rendition of this construct in prose, and they would still not understand = default applied to SMFs as opposed to the default ctor.

      So, it seems like just listing = default on the signature line of the function would be the most concise and most precise way to convey this information.

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

            docteam Qt Documentation Team
            mmutz Marc Mutz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes