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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

Reply via email to