My preference is to remove null termination:

* I'm guessing most strings aren't passed to C. (What are the most
common C string calls in rustc?)

* C functions that scan for null are inefficient, so they're even more
likely to be replaced with Rust equivalents than other C functions.

* Null termination is not sufficient for interop with C. You also have
to ensure the strings don't contain null characters. (This is a common
source of bugs in Firefox, since JavaScript strings and strings from
the network can contain null characters.) And if null characters are
present, what do you do?

* Each C function has its own expectations about character encoding
and allowed characters, so calls to C involve extra state-tracking or
checks anyway.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to