On 13 Nov 2014, at 14:45, Rainer Wiesenfarth <[email protected]> wrote:
> One of my colleagues just asked the rather philosophical question why the > result of QFile::pos() - and thus QIODevice::pos() - is of type qint64 (and > thus signed). He had expected an unsigned type, ideally size_t or offset_t. > > I was unable to find a reason, but maybe someone on the list can step in? git grep ftell in qtbase tells me that QT_FTELL is defined as ftello on some platforms and ftell on others. And ftell uses a signed number, and uses -1 to indicate an error (so I would assume the error case is the reason for using a signed number, even though it halves the largest-representable offset). But the man page says ftello does that too, so off_t must be also signed. Apparently the reason off_t exists is so that you can force it to be 64-bit even on a 32-bit system by setting _FILE_OFFSET_BITS. _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
