-
Notifications
You must be signed in to change notification settings - Fork 163
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
Return CStr
in goblin::strtab::Strtab
instead of str
#345
Comments
This would be a pretty enormous breaking change for goblin, and I'd hate to think of the ergonomic issues around dealing with strings from this Strtab after a change like this. Do you have a particular example where using rusts str doesn't work today (e.g., a string in a binary that isn't valid utf-8?) I assume this issue would have come up before if people were encountering it in the wild? |
@m4b I agree about the breakage/ergonomics concerns, but I also agree that those strings are just a bag of bytes with unknown encoding and a NUL terminator, i.e. What would you think about adding |
|
Isn't this the reason behind goblin still in major version zero?
Transforming a
No, but I don't want to assume UTF-8 encoding, especially if I'm building tools around goblin.
I would argue the opposite, because UTF-8 validation is an additional operation that should not be included in the default |
So for now I don't think I want to proceed with this; it will be too intrusive a change for everyone involved. I'm not convinced that switching everything to Cstr is correct without a compelling example where we fail today. |
There is no way to get access to null-terminated C strings that are not valid UTF-8, through
goblin::strtab::Strtab
.Strtab.get()
andStrtab.get_at()
should returnOption<&CStr>
instead of optional UTF-8str
s.The text was updated successfully, but these errors were encountered: