The line
std::unique_ptr<PHYSFS_sint64> myBuf(new PHYSFS_sint64[PHYSFS_fileLength(myfile)]);
produces the warning
warning C4244: 'initializing' : conversion from 'PHYSFS_sint64' to 'unsigned int', possible loss of data
PHYSFS_sint64
is a typedef for singed long long
PHYSFS_fileLength
returns a PHYSFS_sint64
.
So I don't understand why the compiler tries to convert from signed long long
to unsigned int
when I just try to assign a signed long long
to a signed long long
?
When I explicitly type signed long long
instead of PHYSFS_sint64
it still outputs the same warning
Am I being stupid right now? I don't get it
You haven't really given enough information, but the likely explanation is that size_t
(the type used to represent the range of array indexes and sizes supported by your implementation) is a 32-bit quantity. Which means, to use a 64-bit integer (signed or not) as an array size, your compiler would convert it to 32-bit in some manner.
If this is correct, you will find that size_t
and unsigned int
with your compiler are the same (which the standard permits but does not require), and both are a 32-bit type (which, again, are permitted but not required). Which probably all means you are using a 32-bit implementation.
An alternative - but highly unlikely - explanation is that you have a buggy compiler which does not handle the standard conversions between integral types of different sizes correctly in expressions. I say unlikely, as a compiler with such bugginess is more likely to produce faulty executable code without a whimper, rather than giving warnings about it.