News for hackers. Stuff that matters.
Re:Designing a better strcpy by WalterBright on Saturday June 19, 2021 @09:21PM (#27566161)
Embedding the length means you cannot slice strings. To get a substring one has to reallocate.

Of course, null termination also means that slicing is restricted to being a tail.

Re:Designing a better strcpy by gpderetta on Sunday June 20, 2021 @05:29AM (#27568482)
ideally the length should go with the pointer, not with the string.
Re:Designing a better strcpy by vore on Saturday June 19, 2021 @10:35PM (#27566617)
I feel like to an extent string_view solves that, but in C++ at least you end up having to juggle lifetimes under the hood.