3 ms·
Compilers cheat when working with known libraries - they don't need annotations on known functions, much like they don't need the specific implementation of the
by JonChesterfield 3y ago
Compilers cheat when working with known libraries - they don't need annotations on known functions, much like they don't need the specific implementation of them to know the semantics. This occasionally goes wrong when the compiler assumes any function with a given name must be that function from libc, e.g. the programmer writes a function called `sin`, there's a risk of it being mistaken for the libm function.
- woodruffw 3y agoRight. It's less known libraries I'm worried about (libc can easily be layered over, as you've said) and more unknown ones. In particular: there are a lot of ~universally used libraries with ludicrously complex C APIs that undergo significant own/borrow semantic changes between releases. Things like OpenSSL. These libraries will need to carry these annotations upstream for correctness and up-datedness reasons.