[Qt5-feedback] Real 64 Bit support ?

Thiago Macieira thiago at kde.org
Tue May 17 11:17:48 CEST 2011


On Tuesday, 17 de May de 2011 10:26:39 Andre Somers wrote:
> > That said, I'd much prefer ssize_t to the current int.  The 2GB limit on
> > 64bit systems would disappear, without impacting 32bit systems.
> 
> Then we are back with data exchange issues, are we not? How would a 32 bit
> Qt application deal with a data file that contains a list of 2^32 + x
> elements? Or that requires an address space larger than 2^32?

Well, you have to remember to properly cast the size type to a fixed width 
(i.e., not ssize_t). The wire format must be the same, so we must choose the 
64-bit type.

That means writing code like this:
	stream << qint64(container.size());
	/* stream the elements */
and
	qint64 size;
	stream >> size;
	container.reserve(ssize_t(size));
	/* read the elements */

Of course you cannot load more than 2^32 items into a container on 32-bit, so 
your question is not relevant.
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt.nokia.com/pipermail/qt5-feedback/attachments/20110517/52ac0006/attachment.bin 


More information about the Qt5-feedback mailing list