Results 1 to 5 of 5

Thread: typedef unsigned qint32 uint32_t ?

  1. #1
    Join Date
    Nov 2009
    Posts
    59
    Thanks
    20
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default typedef unsigned qint32 uint32_t ?

    I don't know why I declare typedef unsigned qint32 uint32_t; then it gives me an erros
    unexpected token uint32_t
    thanks

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: typedef unsigned qint32 uint32_t ?

    If you are using Qt Creator, try putting your cursor on 'qint32', then right click and select 'follow symbol under cursor'. This will open up qglobal.h. It should be clear what you did wrong if you find the definition of qint32.

    why don't you just use quint32?

  3. The following user says thank you to schnitzel for this useful post:

    zoz (30th May 2010)

  4. #3
    Join Date
    Nov 2009
    Posts
    59
    Thanks
    20
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: typedef unsigned qint32 uint32_t ?

    Quote Originally Posted by schnitzel View Post
    If you are using Qt Creator, try putting your cursor on 'qint32', then right click and select 'follow symbol under cursor'. This will open up qglobal.h. It should be clear what you did wrong if you find the definition of qint32.

    why don't you just use quint32?
    this i an part of the qgloba.h
    Qt Code:
    1. l QT_BEGIN_HEADER
    2. QT_BEGIN_NAMESPACE
    3.  
    4. /*
    5.   Size-dependent types (architechture-dependent byte order)
    6.  
    7.   Make sure to update QMetaType when changing these typedefs
    8. */
    9.  
    10. typedef signed char qint8; /* 8 bit signed */
    11. typedef unsigned char quint8; /* 8 bit unsigned */
    12. typedef short qint16; /* 16 bit signed */
    13. typedef unsigned short quint16; /* 16 bit unsigned */
    14. typedef int qint32; /* 32 bit signed */
    15. typedef unsigned int quint32; /* 32 bit unsigned */
    To copy to clipboard, switch view to plain text mode 

    I don't know why wrong is?
    thanks

  5. The following user says thank you to nthung for this useful post:

    zoz (30th May 2010)

  6. #4
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: typedef unsigned qint32 uint32_t ?

    I believe (somebody pls correct me if I'm wrong) that you can only use basic types with certain attributes. The 'unsigned' attribute can only be used with a basic type.

  7. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: typedef unsigned qint32 uint32_t ?

    Your correct, 'unsigned' can only be used with the basic types 'char' and 'int'.

Similar Threads

  1. qint32 vs int32_t
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2009, 18:14
  2. typedef question
    By MarkoSan in forum Newbie
    Replies: 5
    Last Post: 29th January 2008, 08:28
  3. typedef Related doubts?
    By rajeshs in forum General Programming
    Replies: 3
    Last Post: 2nd January 2008, 19:05
  4. Conversion from unsigned char* to unsigned char
    By santosh.kumar in forum General Programming
    Replies: 1
    Last Post: 6th August 2007, 13:12
  5. Typedef quint16 on ARM and Win32
    By sgrasic in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 16th May 2006, 22:27

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.