|
|
Message-ID: <20260420235628.GJ1827@brightrain.aerifal.cx> Date: Mon, 20 Apr 2026 19:56:28 -0400 From: Rich Felker <dalias@...c.org> To: Charles Munger <clm@...gle.com> Cc: musl@...ts.openwall.com Subject: Re: Request for feedback on WG14 proposal N3849 (alloc_at_least) On Mon, Apr 20, 2026 at 03:11:38PM -0700, Charles Munger wrote: > https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3849.pdf > > On the WG14 mailing list it was raised that musl had objections to this > proposal and others dealing with exposing allocator sizes. I hope that I > and my coauthors wrote this in a way that would be unobjectionable to > allocator/libc maintainers, but if this will cause you problems I would > like to know, and welcome any and all of your feedback. I'm not sure what specific objections you're referring to. I have not seen concrete evidence that any of this has any practical value. I raised that objection early in the discussion of this whole topic, and I don't think anyone ever presented measurements that support the need for any action whatsoever here. In the absence of that, I do not think anything like this should be adopted. If it is adopted, we would probably just have these functions all be thin wrappers for malloc that report that the size obtaned is exactly what you requested. Aside from that: 1. The "alloc_result_t" approach is particularly ugly and anti-idiomatic for C. Returning a void * pointer and taking a size_t * argument for a location to store the amount actually obtained would be a lot more idiomatic and discourage misuse. 2. The proposed free_sized and free_aligned_sized functions seem completely useless. As they have undefined behavior if the size and alignment you pass to them are not correct, they offer no advantage over just calling free, but make things much more error-prone. Overall, I would urge the committee to reject this whole proposal. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.