Just curious if it is syntactically possible to do something like this:
static (void) someFunc();
instead of, say,
static bla = someFunc();
so as to invoke someFunc only once when we go through that section of code? The (void) snippet doesn’t compile by the way.
No,
staticis intended only to work with value initialization.To document that you aren’t interested in the return value, you could write:
The
void()is to prevent a comma operator being called; you could also write(void(someFunc()), 0)using a functional cast.