Array errors w/hex Uint32/Uint64 etc

I created an array of hex 8-bit numbers. I found I could not use the Integer type. The error was: 

“Type mismatch error: expected Integer() but got Uint64()”

That was fine, I changed the array to Uint64.
Then I made the module external, and brought it into a different Xojo binary project. And in that project, the complaint was:
“Type mismatch error: expected Integer() but got Uint32()”

So now only one of these two projects will compile if using an external module.

Strange but true. But why? Is there are a hidden setting somewhere?

I am using 2018 1.1. Please don’t tell me to upgrade. Code below


Dim myArray(NUM_CHARS - 1) As Uint32 = Array(&h0,&h6,&h22,&h0,&h0,&h0,&h0,&h2,_

The Array function will return a best-guess array. If you want to be sure, create your own function to return an array of the correct type, like so:

Function UInt8Array (ParamArray arr() As UInt8) As UInt8()
  return arr
End Function

dim myArray() as UInt8 = UInt8Array(&h0, &h6, ... )

Edit to include parens in the return parameter.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.