Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. What is this thing in my STRUCT?

What is this thing in my STRUCT?

Scheduled Pinned Locked Moved C++ Gurus
5 Posts 3 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dr_Firmware
    wrote on last edited by
    #1

    Hi Qt's,

    I did the search and even reread chapter 8 of "The C++ Programming Language".

    So I am trying to get up to speed on Qt and C++ and came across this little gem in an example:

    //Structure for the response to the QUERY_EXTENDED_INFO command
        union ExtendedQueryInfo
        {
            unsigned char command;
            struct
            {
                unsigned char command;
                uint16_t bootloaderVersion;
                uint16_t applicationVersion;
                uint32_t signatureAddress;
                uint16_t signatureValue;
                uint32_t erasePageSize;
                unsigned char config1LMask;
                unsigned char config1HMask;
                unsigned char config2LMask;
                unsigned char config2HMask;
                unsigned char config3LMask;
                unsigned char config3HMask;
                unsigned char config4LMask;
                unsigned char config4HMask;
                unsigned char config5LMask;
                unsigned char config5HMask;
                unsigned char config6LMask;
                unsigned char config6HMask;
                unsigned char config7LMask;
                unsigned char config7HMask;
                unsigned char pad[USB_PACKET_SIZE_WITH_REPORT_ID - 29];
            }PIC18;
            struct
            {
                unsigned char command;
                uint16_t bootloaderVersion;
                uint16_t applicationVersion;
                uint32_t signatureAddress;
                uint16_t signatureValue;
                uint32_t erasePageSize;
                uint16_t configxxMask...
                unsigned char pad[USB_PACKET_SIZE_WITH_REPORT_ID - XX];
            }PIC24;
        };
    

    Can someone explain the purpose of the PIC18 and PIC24 at the end of those 2 struct's?

    Regards,

    Chris

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2
       struct
               {
                   unsigned char command;
                   uint16_t bootloaderVersion;
                   uint16_t applicationVersion;
                   uint32_t signatureAddress;
                   uint16_t signatureValue;
                   uint32_t erasePageSize;
                   uint16_t configxxMask...
                   unsigned char pad[USB_PACKET_SIZE_WITH_REPORT_ID - XX];
               } PIC24;
      

      This defines an anonymous structure and declares a variable of this type named "PIC24" .

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        That's rather a general C/C++ question unrelated to Qt but anyway, here you have the complete explanation

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        D 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          That's rather a general C/C++ question unrelated to Qt but anyway, here you have the complete explanation

          D Offline
          D Offline
          Dr_Firmware
          wrote on last edited by
          #4

          @SGaist thanks for the warm reception.

          Thanks for the link. I have written firmware in C and some desktop apps in C#. And since I'm no expert in either, moving to C++ in Qt it becomes a little unclear what code related items are strictly C++ and which are part of the Qt IDE.

          I hope to get it sorted without committing to many forum faux pas.

          Best regards,

          Chris

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Don't worry for that, you won't be eaten ;)

            I've forgotten that there's also the C++ Guru sub forum when you have questions that are more C++ oriented

            Happy coding !

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved