-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Description
julia> reinterpret(UInt32, reinterpret(Char, 0x00ff0000))
0x00000000
julia> u2c(u::UInt32) = reinterpret(Char, u)
u2c (generic function with 1 method)
julia> c2u(c::Char) = reinterpret(UInt32, c)
c2u (generic function with 1 method)
julia> u2c(0x00ff0000)
'\0': ASCII/Unicode U+0000 (category Cc: Other, control)
julia> c2u(u2c(0x00ff0000))
0x00000000
julia> u2u(u) = c2u(u2c(u))
u2u (generic function with 1 method)
julia> u2u(0x00ff0000)
0x00ff0000
julia> c2u(u2c(0x00ff0000))
0x00000000The fortunate thing is that it doesn't seem to be broken in a way that affects any Char values that can be produced naturally—you can only produce the values for which this is broken through reinterpret of UInt32 values.
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior