Why static analysis is the way to go

Dennis dkorpel at gmail.com
Thu May 28 23:35:51 UTC 2026


On Thursday, 28 May 2026 at 22:58:33 UTC, H. S. Teoh wrote:
> Should I return a pointer to a static string buffer?

No

> Should I allocate and hope my caller doesn't forget to free?

No

> Should I ask instead for a buffer from the caller to fill?

Maybe, but an Arena* parameter is better

https://www.dgtlgrove.com/p/untangling-lifetimes-the-arena-allocator

But yeah GC is the easiest API to use.


More information about the Digitalmars-d mailing list