Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: add pointer(s::Union(ByteString,UTF16String,UTF32String)) #5703

Merged
merged 1 commit into from
Feb 11, 2014

Conversation

stevengj
Copy link
Member

@stevengj stevengj commented Feb 6, 2014

This patch adds pointer(s) for s::Union(ByteString,UTF16String,UTF32String) and substrings thereof. Not only is this more convenient than convert(Ptr{Foo}, s) (because s knows the correct pointer type), but it also works for arbitrary substrings (whereas convert throws an error if the substring is not at the end).

The patch also changes the chars field of UTF32String to data for consistency with our other string types; this makes it easier to write methods that work on Union(ByteString,UTF16String,UTF32String).

Also, I changed the signature in pointer{T}(x::AbstractArray{T}, i::Int) to pointer{T}(x::AbstractArray{T}, i::Integer), since I couldn't see any reason to restrict the index to Int here.

@aviks
Copy link
Member

aviks commented Feb 6, 2014

+1. This is a much cleaner interface.

@stevengj
Copy link
Member Author

Ping @JeffBezanson

JeffBezanson added a commit that referenced this pull request Feb 11, 2014
RFC: add pointer(s::Union(ByteString,UTF16String,UTF32String))
@JeffBezanson JeffBezanson merged commit fbb5b12 into JuliaLang:master Feb 11, 2014
stevengj added a commit that referenced this pull request Feb 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants