News for hackers. Stuff that matters.
Re:C Strings and my slow descent to madness by WalterBright on Friday April 07, 2023 @12:32AM (#35478054)
You can use automatic memory management and not worry about it. Or you can use D's prototype ownership/borrowing system. Or you can encapsulate them in something that manages the memory. Or you can do ownership/borrowing by convention (it's not hard to do).
Re:C Strings and my slow descent to madness by saagarjha on Friday April 07, 2023 @03:46AM (#35479223)
Automatic memory management makes copies?
Re:C Strings and my slow descent to madness by WalterBright on Friday April 07, 2023 @09:08AM (#35481193)
No. Another word for automatic memory management is garbage collection.
Re:C Strings and my slow descent to madness by saagarjha on Friday April 07, 2023 @11:00PM (#35490059)
I guess I should rephrase. Let's say I have a string, which owns its buffer. What happens in D if I take a substring of it? Does a copy of that section occur to form a new string?