Results 1 to 6 of 6

Thread: how to use a global vars in QT?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to use a global vars in QT?

    Quote Originally Posted by wter27 View Post
    The compiler says may be used uninitialized in this function.
    you have two functions. "function_name_1" initializes "var_name". "function_name_2" uses "var_name". What happens if you call "function_name_2" before you call "function_name_1"? - BINGO, you'd use an uninitialized variable, as the compiler said...

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: how to use a global vars in QT?

    Quote Originally Posted by FelixB View Post
    What happens if you call "function_name_2" before you call "function_name_1"? - BINGO, you'd use an uninitialized variable, as the compiler said...
    That doesn't even matter, even if function_name_1 is called before function_name_2, var_name is uninitialised.

  3. #3
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to use a global vars in QT?

    Quote Originally Posted by tbscope View Post
    That doesn't even matter, even if function_name_1 is called before function_name_2, var_name is uninitialised.
    oh, now I see. he redefines "var_name"...

Similar Threads

  1. How to specify my own global typedefs
    By Gert van Kruiningen in forum Qt Programming
    Replies: 7
    Last Post: 20th January 2011, 05:11
  2. qmake, subdirs & global vars
    By jpujolf in forum Qt Tools
    Replies: 0
    Last Post: 21st May 2009, 09:05
  3. global variable
    By Shuchi Agrawal in forum General Programming
    Replies: 10
    Last Post: 15th February 2007, 04:19
  4. Qt and global variables
    By Morea in forum Qt Programming
    Replies: 11
    Last Post: 1st February 2007, 23:42
  5. Where does VS save its inviornment vars?
    By high_flyer in forum Installation and Deployment
    Replies: 5
    Last Post: 4th February 2006, 10:10

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.