Results 1 to 11 of 11

Thread: Pointers and references

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    8
    Thanked 133 Times in 128 Posts

    Default Re: Pointers and references

    hope now it works... i have edited the above post

  2. #2
    Join Date
    Mar 2009
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: Pointers and references

    I had already tried your suggestion. I had added [8] for this error message:

    error: cannot convert ‘MatrixModule::PinConfiguration (*)[8]’ to ‘MatrixModule::PinConfiguration*’ in assignment

  3. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    8
    Thanked 133 Times in 128 Posts

    Default Re: Pointers and references

    you have to remove the [8] and bring back the *... take a look at the post again..

  4. #4
    Join Date
    Mar 2009
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: Pointers and references

    Qt Code:
    1. //! Set the widget values from the PinConfiguration structure provided
    2. void IOPortConfig::setConfig(MatrixModule::PortConfiguration &config)
    3. {
    4. MatrixModule::PinConfiguration *ports[2];
    5.  
    6. ports[0] = &(config.port0);
    7. ports[1] = &(config.port1);
    To copy to clipboard, switch view to plain text mode 

    error: cannot convert ‘MatrixModule::PinConfiguration (*)[8]’ to ‘MatrixModule::PinConfiguration*’ in assignment

  5. #5
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    8
    Thanked 133 Times in 128 Posts

    Default Re: Pointers and references

    oh.. man... i should have read your first post carefully... my mistake my mistake.. sorry.. give me a minute..

    EDIT : ... remove the & now.

    Qt Code:
    1. port[1] = /*&*/config.port;
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to nish for this useful post:

    PaceyIV (27th July 2009)

  7. #6
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    8
    Thanked 133 Times in 128 Posts

    Default Re: Pointers and references

    hope it works now

    EDIT: i was all the time confusing Port and Pin as same Configuration
    Last edited by nish; 27th July 2009 at 10:48.

  8. #7
    Join Date
    Mar 2009
    Posts
    98
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: Pointers and references

    It works! Good.

    Yes, sure! config.port is a pointers to config.port[0]. I should have used the & with config.port[0].
    Now I can also re-add the const.

    Thanks!

Similar Threads

  1. Use/Misuse of Pointers
    By ct in forum General Programming
    Replies: 12
    Last Post: 8th May 2007, 23:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.