logoalt Hacker News

rssoconnortoday at 1:35 PM1 replyview on HN

Naming an externally linked function with the prefix "str" is by itself UB since that prefix is reserved for <string.h>.


Replies

ncrucestoday at 2:04 PM

Right. I am doing a standard library replacement, and forgot I needed to compile freestanding. Oops. My bad.

So `str` and `mem` are reserved. But then so are `to` and `is` (by <ctype.h>). Just forget about having a function named `is_valid_user`.

And so are `mtx_`, `cnd_`, `thrd_`, `atomic_`, `memory_`...

Which is why... everything in C is UB.