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

Investigate QCanBusFrame API improvements

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P2: Important
    • 5.8.0 Beta
    • 5.6.0
    • SerialBus: CAN Bus
    • None

    Description

      Suggestions from mmutz:

      • add a proper default ctor so that not every default construction
        copy-constructs a QByteArray, e.g. by removing the = 0 from the current one
        and adding type = DataFrame to the FrameType ctor.
      • add more nothrow markers. when doing so, drop the redundant inline keywords
        and QCanBusFrame:: qualifcations.
      • not all methods need to be or even should be inline; that includes the
        constructors, but not the the special member functions (except, maybe the
        default ctor), though, and the class as a whole should stay unexported.
      • don't use bit fields, they produce bad code on at least gcc and have
        implementation-defined layout. do the shifting and masking yourself on a
        quint64. You might then steam that quint64 instead of individual fields.
      • remove the 'reserved' field. As it currently is, you cannot use it anyway,
        because no ctor inits it, so it contains random garbage. (init to zero for now)
      • TimeStamps should be passed by value
      • Create a type for frame IDs instead of using quint32: "type-rich interfaces"
      • since setPayload and the ctor are unconditional sinks for their QByteArray
        arguments, those arguments should be passed by value and be moved from.

      These changes must be done before the first final release of the API in Qt 5.8. Qt 5.7 and Qt 5.6 are TP releases for this API.

      Attachments

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

        Activity

          People

            aha_1980 André Hartmann
            ablasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes