PDA

View Full Version : typedef unsigned qint32 uint32_t ?



nthung
28th May 2010, 04:25
I don't know why I declare typedef unsigned qint32 uint32_t; then it gives me an erros
unexpected token uint32_t
thanks

schnitzel
28th May 2010, 05:06
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?

nthung
28th May 2010, 05:14
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

l QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE

/*
Size-dependent types (architechture-dependent byte order)

Make sure to update QMetaType when changing these typedefs
*/

typedef signed char qint8; /* 8 bit signed */
typedef unsigned char quint8; /* 8 bit unsigned */
typedef short qint16; /* 16 bit signed */
typedef unsigned short quint16; /* 16 bit unsigned */
typedef int qint32; /* 32 bit signed */
typedef unsigned int quint32; /* 32 bit unsigned */

I don't know why wrong is?
thanks

schnitzel
28th May 2010, 19:58
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.

squidge
28th May 2010, 20:57
Your correct, 'unsigned' can only be used with the basic types 'char' and 'int'.