PDA

View Full Version : which one is constant,sizeof(int) or sizeof(long)?



coralbird
20th March 2006, 00:48
In order to transport a class through Tcp,I have to define constant length's variable in this class,between int and long,which one's size is constant on differernt CPU Type(32 and 64 bit)?
thank you!

Chicken Blood Machine
20th March 2006, 01:52
You shouldn't rely on either (all though in most cases you can).

Instead use qint32, qint64, etc.

coralbird
20th March 2006, 02:44
but neither qint32 nor qint64 is defined in qt3.3.4.

Chicken Blood Machine
20th March 2006, 03:51
but neither qint32 nor qint64 is defined in qt3.3.4.

Q_INT32 and Q_INT64. They're all defined in qglobal.h

coralbird
20th March 2006, 11:01
thank Chicken Blood Machine !I have solved this problem as your guide.