News for hackers. Stuff that matters.
Re:Rust is now overall faster than C in benchmarks by rcoveson on Sunday January 03, 2021 @05:21PM (#25625781)
Null terminated strings are often called cstrings. They’re beyond idiomatic; they’re part of the C standard library.
Re:Rust is now overall faster than C in benchmarks by akkartik on Sunday January 03, 2021 @05:25PM (#25625802)
Also Unix. Syscalls return null-terminated strings all over the place. So any language running on Unix has to deal with null-terminated strings.

I know because I run a userland that uses length-prefixed strings as far as possible: https://github.com/akkartik/mu

Re:Rust is now overall faster than C in benchmarks by lambda on Sunday January 03, 2021 @06:03PM (#25626132)
Not just the standard library, but the core language. They are what you get if you write a string literal in your code.
Re:Rust is now overall faster than C in benchmarks by jacoblambda on Monday January 04, 2021 @02:38AM (#25628648)
Yes but if we are being pedantic no. Of course the language does still greatly lean into the null terminated string concept.

You get a null terminated char array but the length is actually available since arrays (as long as they haven't decayed into pointers) can still share their length at compile time.

Re:Rust is now overall faster than C in benchmarks by michaelmior on Sunday January 03, 2021 @05:31PM (#25625844)
True. I was skipping over that, but the fact that functions manipulating null terminated strings are part of the standard library is certainly a reason in itself to consider them idiomatic.
Re:Rust is now overall faster than C in benchmarks by akkartik on Sunday January 03, 2021 @05:47PM (#25625973)
They're agreeing with you.
Re:Rust is now overall faster than C in benchmarks by michaelmior on Sunday January 03, 2021 @06:00PM (#25626092)
Yes, I understand :)