Skip to content

rodata in std::str may be an unfamiliar term #18449

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

Closed
mdinger opened this issue Oct 30, 2014 · 10 comments
Closed

rodata in std::str may be an unfamiliar term #18449

mdinger opened this issue Oct 30, 2014 · 10 comments

Comments

@mdinger
Copy link
Contributor

mdinger commented Oct 30, 2014

In std::str, there is a typo. I don't know what rodata is supposed to be:

//! String literals are allocated statically in the rodata of the
                                                    ^ ~~~~~
@Gankra
Copy link
Contributor

Gankra commented Oct 30, 2014

rodata is standard OS jargon for the Read-Only Data segment of a program. Or are you suggesting that they are in fact allocated elsewhere?

@mdinger
Copy link
Contributor Author

mdinger commented Oct 30, 2014

No, I just didn't know what it meant. I'm familiar with read only but I definitely didn't recognize it as an acronym.

@mdinger mdinger changed the title Typo in std::str rodata in std::str may be an unfamiliar term Oct 30, 2014
@gamazeps
Copy link
Contributor

@mdinger I tried to make it more explicit that rodtaa is a section of the executable, do you think that it is clear enough ?

@mdinger
Copy link
Contributor Author

mdinger commented Oct 30, 2014

Hmm...Overall I'm ambivalent I guess. Adding a period does suggest it's less likely to be misspelled (because methods sometimes are cryptic) but doesn't point toward what it might mean unless you already know.

I would probably just link to wikipedia or expand it in place to read-only data or rodata (read-only data). A search of the repository only shows one other hit of rodata so it's not commonly used term in rust docs. So, it's probably not critical that everyone understands the term.

@thestinger
Copy link
Contributor

The fact that it's in the rodata section on some platforms is an implementation detail. The documentation should be sticking to information that's relevant to either the high-level semantics or the performance characteristics rather than throwing in trivia about the implementation.

@gamazeps
Copy link
Contributor

@thestinger Honestly I think the notion of section really help to understand for C people (at least the people used to do bare-metal).

@thestinger
Copy link
Contributor

Low-level programmers don't need help to understand how an immutable (ptr, len) view works. A semi-accurate statement about implementation details isn't helping anyone.

@gamazeps
Copy link
Contributor

Well the other solution is to remove the statement totally if you want.
But honestly, when I read it (before this issue), it really helped ...

@thestinger
Copy link
Contributor

I think it should be replaced with documentation explaining that string literals are immutable views with a static lifetime (&'static str) rather than meandering off into implementation details (which aren't actually guaranteed or portable).

@gamazeps
Copy link
Contributor

@thestinger better ?

bors added a commit that referenced this issue Nov 2, 2014
Made the fact that rodata is a section of the executable more explicit
Closes #18449
@bors bors closed this as completed in 4ee0c4f Nov 3, 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 a pull request may close this issue.

5 participants