emscripten-core / emscripten-core/emscripten
embind should use the length that std::string already knows
Open
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Per [a comment on another issue](https://github.com/emscripten-core/emscripten/pull/13304#issuecomment-778637859) embind doesn't make use of `std::string` knowing its length when converting to a JS string. Treating `std::string` as a C string is both unnecessarily inefficient and, in the case of embedded U+0000, in correct.
Please use the length already known and avoid `strlen` when converting a `std::string` to a JS string.
Contributor guide
Assessment
This issue has not been assessed yet.