Skip to content

Commit

Permalink
specialize cconvert instead of unsafe_convert
Browse files Browse the repository at this point in the history
JuliaLang/julia#51962 (comment)

> 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)
  • Loading branch information
nsajko committed May 1, 2024
1 parent c102065 commit 5ea2a1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/FixedSizeArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down

0 comments on commit 5ea2a1c

Please sign in to comment.