From e1c3b345e60492ef057af3578d0f7a8a6ad99541 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Thu, 2 May 2024 02:04:53 +0200 Subject: [PATCH] specialize `cconvert` instead of `unsafe_convert` (#51) https://github.com/JuliaLang/julia/issues/51962#issuecomment-1787811957 > It is generally best to implement cconvert (since it is not unsafe), > and generally required to call both functions as well (mimicking the > behavior defined for ccall) --- src/FixedSizeArrays.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FixedSizeArrays.jl b/src/FixedSizeArrays.jl index 3715045..f8712d2 100644 --- a/src/FixedSizeArrays.jl +++ b/src/FixedSizeArrays.jl @@ -189,7 +189,7 @@ end # unsafe: the native address of the array's storage -Base.unsafe_convert(::Type{Ptr{T}}, a::FixedSizeArray{T}) where {T} = Base.unsafe_convert(Ptr{T}, a.mem) +Base.cconvert(::Type{<:Ptr}, a::FixedSizeArray) = a.mem # `elsize`: part of the strided arrays interface, used for `pointer`