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

Improve docs for bystestring regarding null-termination #7036

Closed
nalimilan opened this issue May 29, 2014 · 3 comments · Fixed by #7048
Closed

Improve docs for bystestring regarding null-termination #7036

nalimilan opened this issue May 29, 2014 · 3 comments · Fixed by #7048
Labels
docs This change adds or pertains to documentation

Comments

@nalimilan
Copy link
Member

?bytestring says:

Base.bytestring(s)

Convert a string to a contiguous byte array representation
appropriate for passing it to C functions. The string will be
encoded as either ASCII or UTF-8.

It isn't clear whether the string will be null-terminated or not. I can fix this if you tell me whether it's the case or not.

(Also, it might be clearer to replace s with s::String.)

@JeffBezanson
Copy link
Member

The underlying data will be a Vector{Uint8}, which always has an implicit zero byte after the end (it's put there by the runtime system, but you can't see it).

@stevengj
Copy link
Member

In #7016 I updated the docs to mention that string data is internally NUL-terminated in Julia for passing to C.

@stevengj stevengj added the doc label May 29, 2014
@nalimilan
Copy link
Member Author

@stevengj Yes, that's great, but I'd also like to add it to ?bytestring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants