So going through the QFile docs, I found QFile::size() returns a qint64.
It would make sense (to me atleast) if QFile::size() returned an unsigned integer i.e. quint64 as file sizes range from 0 bytes and upwards. QFile::size()
reimplements some methods from parent classes, i.e. QFileDevice::size() and it again from QIODevice::size(). In non of these implementations any mention is made of negative numbers i.e. -1, etc.
The base implementation in QIODevice::size() has a description:
For open random-access devices, this function returns the size of the device. For open sequential devices, bytesAvailable() is returned.
If the device is closed, the size returned will not reflect the actual size of the device.
In QIODevice::bytesAvailable() which dictates the return type of QIODevice::size()
also makes no mention of -1 return values, however its return type is also qint64
.
Is this an design decision for Qt that has a use for negative numbers if file sizes, and be extension their parent class(es) too i.e.