zephyr: Potential bugs re. 'static inline' and static variables
Prompted by some discussion on Slack, haven’t looked for problems.
If you put
static inline void f(void)
{
static int x;
...
}
in a header, you’ll get a separate x variable for each translation unit that includes it. It works just like a regular static function there. The inline makes no difference.
@tautologyclub might’ve found some stuff that assumes x is shared.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (10 by maintainers)
Sounds pretty ad hoc to me. Either you need reentrancy or you don’t. What happens if I call that sprintf function twice in the same stack? Etc… Can you truly 100% vouch for correctness in all such possible situations?