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

[std] clarify ffi C string nul term & length discussion #56140

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@jnqnfe
Contributor

jnqnfe commented Nov 21, 2018

re-written the paragraph, including:

  • Changed use of "calculated" to "measured". "calculated" just sounds
    wrong, giving a false impression of what strlen() does.
  • Changed "C code must manually call a function". Firstly, "manually"?
    Secondly, a function is called in Rust also... the difference is in
    what the function does - measurement v.s. reading an attribute...
  • Finished that sentence in actually stating the operation that is done.
  • Changed use of "buffer length" to "string length". Use of the term
    "buffer" here was bound to confuse.
@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 21, 2018

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @TimNN (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@TimNN

This comment has been minimized.

Contributor

TimNN commented Nov 27, 2018

  • Changed use of "calculated" to "measured". "calculated" just sounds
    wrong, giving a false impression of what strlen() does.

I don't agree with the change to measured. My intuition (as a non-native English speaker) is that "measure" implies measuring something physical (e.g. distance, time). The dictionary seems to confirm that intuition.

which scans through the bytes of the string looking for the nul character marking the end, keeping a count of characters as it does so.

I don't think describing how strlen may-or-may-not be implemented internally is appropriate here. I'd rather focus on what it returns (essentially the position of the first 0 byte).

@jnqnfe jnqnfe force-pushed the jnqnfe:ffi_nul_len_discussion branch from 7f66e03 to b8da5ef Nov 28, 2018

@jnqnfe

This comment has been minimized.

Contributor

jnqnfe commented Nov 28, 2018

I've rewritten it again, hopefully you'll like v2 better. Sorry for the delay, I've got very irregular internet access currently.

I don't agree with the change to measured. My intuition (as a non-native English speaker) is that "measure" implies measuring something physical (e.g. distance, time). The dictionary seems to confirm that intuition.

Ok, I wasn't 100% happy with it either, but it was better. I've used "counting" instead in v2.

I don't think describing how strlen may-or-may-not be implemented internally is appropriate here. I'd rather focus on what it returns (essentially the position of the first 0 byte).

I think the discussion necessitates brief mention that it involves counting. I hope you like the revised text more.

@bors

This comment has been minimized.

Contributor

bors commented Dec 8, 2018

☔️ The latest upstream changes (presumably #56578) made this pull request unmergeable. Please resolve the merge conflicts.

@jnqnfe jnqnfe force-pushed the jnqnfe:ffi_nul_len_discussion branch from b8da5ef to 85c6548 Dec 12, 2018

clarify ffi C string nul term & length discussion
re-written the paragraph, including:
 - Changed use of "calculated" to "count". "calculated" just sounds
   wrong, giving a false impression of what strlen() does.
 - Changed "C code must manually call a function". Firstly, "manually"?
   Secondly, a function is called in Rust also... the difference is in
   what the function does - counting v.s. reading an attribute...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment