4 ms·
One nitpick here, if you want a generator style function, you need a struct to hold the state, not a static local variable. Otherwise you're limited to one glob
by AndyKelley 11y ago
One nitpick here, if you want a generator style function, you need a struct to hold the state, not a static local variable. Otherwise you're limited to one global function. I can't think of a valid use case for static local variables.
- blt 11y agothey are nice if you want to switch the behavior of a function at runtime with a debugger. I use them a lot when tweaking the constants in GUI layout code. But I have them behind a macro that switches "static" to "const" in optimized builds.