Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> I really wish someone on the C language/compiler/linker level took a real look at the problem and actually tried to solve it in a way that isn't a pain to deal with for people that integrate with the code.

It exists as "inline" and "extern inline".[1] Few people make use of them, though, partly because the semantics standardized by C99 were the complete opposite of the GCC extensions at the time, so for years people were warned to avoid them; and partly because linkage matters are a kind of black magic people avoid whenever possible--"static inline" neatly avoids needing to think about it.

[1] See C23 6.7.5 at https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf#p...

 help



> "static inline" neatly avoids needing to think about it.

Sure, except when you do FFI bindings. Then those functions just don't exist and you get a linking error.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: