mlibc icon indicating copy to clipboard operation
mlibc copied to clipboard

Parameter names should be present in headers

Open ArsenArsen opened this issue 3 years ago • 3 comments

void *memmem(const void *, size_t, const void *, size_t);

->

void *memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len);

This is extremely useful for tooling like clangd, and should provide no downsides.

ArsenArsen avatar Jun 21 '22 18:06 ArsenArsen

The issue with this is that this breaks if a program does #define haystack my_global_state->current_haystack or similar.

avdgrinten avatar Jun 22 '22 07:06 avdgrinten

We would need to prefix these with double underscores, which would be quite ugly.

avdgrinten avatar Jun 22 '22 07:06 avdgrinten

hmm, do any programs do this in practice? I don't think I've seen it happen personally (though I imagine glibc does __haystack for a reason), at least before including libc headers? and while that might be potentially ugly, it is quite a useful tool

ArsenArsen avatar Jun 22 '22 07:06 ArsenArsen