3 ms·
static would move the construction to before main(). In big projects that becomes an issue, when you have tons of little static objects defined here and there.
by yakubin 4y ago
static would move the construction to before main(). In big projects that becomes an issue, when you have tons of little static objects defined here and there.
- kazinator 4y agoIt shouldn't be a problem for something entirely self-contained like a regex. If other static constructions try to use it before main() is called, then that could be a problem.
- yakubin 4y agoI'm not talking about dependencies, but about the time spent before main(). It delays startup. Another thing is that local static variables often compile to fairly horrific long code with branches. Better just move it to a wider scope or a longer-lived struct/class member somewhere.