0

Hello guys Thank you for recent help as I try to use Julia for the first time. Now, another problem: I seem to be unable to use the UintX types.

I have downloaded v1.9.3 and installed it on my laptop, which is a fairly standard Win10 Pro system, fully updated. I frequently work in areas where values have the range [0:255] and arrays are large, so I normally want to use Uint8.

So I started in a REPL session with this:

    julia> z = zeros(Uint8, 2,3)
    ERROR: UndefVarError: `Uint8` not defined
    Stacktrace:
     [1] top-level scope
       @ REPL[6]:1

Hmm. Can't be a package error, because Uint8 is a built-in primitive data type. So says the official manual. However, I can use signed int types without error, eg,

julia> z = zeros(Int8, 2,3)
    2×3 Matrix{Int8}:
     0  0  0
     0  0  0

Experimentation showed that all attempts to use UintX types, in a great variety of ways (all copied straight out of the official user guide at https://docs.julialang.org/en/v1/) fail with the same UndefVarError message. And yet, if I do this:

julia> x = 0x1
    0x01

    julia> typeof(x)
    UInt8

it seems that Julia is not entirely blind to the existence of Uint8: but it's impossible to work with it.

So, I downloaded and tried the portable version of v1.9.3 - same result. Also, I tried it in the VS/Julia IDE - same result. I restarted Windows & reinstalled Julia - same result.

Am I failing to understand something basic, or is there a problem with the UintX types in the current build? Thanks

kordes
  • 29
  • 2

1 Answers1

0

This is UInt8 not Uint8

Here is the list of inbuilt unsigned types:

julia> subtypes(Unsigned)
5-element Vector{Any}:
 UInt128
 UInt16
 UInt32
 UInt64
 UInt8
Przemyslaw Szufel
  • 40,002
  • 3
  • 32
  • 62
  • If you believe this question was a typo then why did you provide an answer? Either vote to close or answer. Please don't do both. – Dharman Aug 26 '23 at 14:01
  • The answer for a "typo" question is useful for the person who made the typo and for nobody else - this is how I interpret it (and the typo here is letter capitalization `i` vs `I`. Maybe I am wrong by I assumed that even when somebody made a typo I can help them. But this question is not useful for anybody else so this should be closed IMO. – Przemyslaw Szufel Aug 26 '23 at 14:08
  • You can just mention the typo in a comment under the question. Posting an answer could block this question from deletion. Generally, don't post an answer that helps only a single person. – Dharman Aug 26 '23 at 14:10