News for hackers. Stuff that matters.
Re:Git's list of banned C functions by kaba0 on Friday March 05, 2021 @03:58AM (#26354571)
It can contain a to_cstring() function and problem solved.

If it uses a struct with length of string and pointer to a c-style string, even the conversion can be elided (at the price of some inflexibility/unnecessary copying while in use)

Re:Git's list of banned C functions by kelnos on Sunday March 07, 2021 @02:16PM (#26378797)
That would mean you lose the ability to do all sorts of optimizations and memory sharing. Or at least, you can do them, but then the c_string() function requires copying the data. And that also means that it's a one-way thing: you can't use the copy on something that wants to modify the string, and expect your FancyString instance to reflect the modification.