Implement `cconvert` for `SubArray` (#60533)
This PR also documents `cconvert` as part of the strided array interface
because it may be needed if the default `cconvert` cannot work.
Here is an example of the bug this change fixes, which is closely
related to the bug in #59685
```julia
struct MyVec <: AbstractVector{UInt8} end
Base.size(::MyVec) = (8,)
Base.getindex(::MyVec, i::Int) = UInt8(i)
struct MyWrapper x::UInt64 end
Base.cconvert(::Type{Ptr{UInt8}}, ::MyVec) = Base.cconvert(Ref{MyWrapper}, MyWrapper(htol(0x0807060504030201)))
Base.unsafe_convert(::Type{Ptr{UInt8}}, x::Ref{MyWrapper}) = Ptr{UInt8}(Base.unsafe_convert(Ref{MyWrapper}, x))
Base.elsize(::Type{MyVec}) = 1
Base.strides(::MyVec) = (1,)
function has_4(v)
r = @ccall memchr(v::Ptr{UInt8}, 0x04::Cint, length(v)::Csize_t)::Ptr{Nothing}
r !== C_NULL
end
has_4(MyVec())
# true
has_4(view(MyVec(), 2:5))
# false
```