Hacker News new | ask | show | jobs
by bregma 706 days ago
> That's why GP suggested annotating them. Typically this would be done via a function attribute.

That won't help when you link external functions or worse, dynamically load them. Those are things done long after the compiler has run.

> And libc implementations already annotate many of their functions to tell the compiler how they work. Compilers are also more than happy to assume behavior of standard function matches the C/C++ standards in non-freestanding environmnets.

We're not talking about standard functions here, we're talking about any function any developer could ever call in a signal context. Ever. Like, for example, a libssh shutdown function that invokes a callback that calls a syslog function that does some socket operation on a buffer that some other thread has already freed. Which of those functions needs the annotation, and how does dlsym() deal with it?

1 comments

Your reply is akin to saying that static analyzers are pointless because of the halting problem.