Results 1 to 9 of 9

Thread: Debug macros in 64bit systems

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    31
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Debug macros in 64bit systems

    Hi all,

    I use the following debug macro to quicly check variables values in code of interest:

    #define dbs(x) qDebug(QVariant(x).toString().latin1())

    I can write something like

    Qt Code:
    1. dbs(5);
    2. dbs("5");
    3.  
    4. int num = 5;
    5. dbs(num);
    6.  
    7. QString str("5");
    8. dbs(str);
    To copy to clipboard, switch view to plain text mode 

    and everything works as expected.

    I have a problem with container's sizes that are size_t types.

    As example:

    Qt Code:
    1. QValueVector<int> v;
    2. v.append(5);
    3.  
    4. dbs(v.count()); // gives an error on 64bit systems
    To copy to clipboard, switch view to plain text mode 

    This is because size_t is an unsigned int 64 bits long and cannot be auto converted by compiler to int or uint types that are 32 bits and are the only constructors defined by QVariant for integral types.

    How can do my macro work as expected? there exsist another way to write a macro with the same results.

    I searched on the net with no results, so here I am asking for an help.

    Thanks
    Marco
    Last edited by wysota; 2nd December 2006 at 08:09. Reason: missing [code] tags

Similar Threads

  1. Replies: 11
    Last Post: 22nd March 2006, 19:06

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.