Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3695

Inconsistent length types

$
0
0

Anyone bothered by this?

FolderItem.length is a UInt64
MemoryBlock.size is an Integer
BinaryStream.BytePosition is a UInt64
BinaryStream.Length is a UInt64
BinaryStream.Read(ByteCount as Integer...)

It means code like this:

var bs as BinaryStream 
[...]
var data as String = bs.read(bs.length) 

throws as complier warning. The compiler warning is incorrect, too, as it says

Converting from UInt64 to Integer causes the sign information to be lost, which can lead to unexpected results

The conversion is actually sign-preserving, but it might cause an overflow.

Reported as https://tracker.xojo.com/xojoinc/xojo/-/issues/77445

4 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 3695

Trending Articles