“Dynamic initialization of a block-scope variable with static storage duration or thread storage duration is performed the first time control passes through its declaration
[…]
this would initialise everything correctly: by the time foo() is called, its b has already been initialised.”
I guess that means this trick can change program behavior, especially if the function containing the static is never called in a program’s execution.
“Dynamic initialization of a block-scope variable with static storage duration or thread storage duration is performed the first time control passes through its declaration
[…]
this would initialise everything correctly: by the time foo() is called, its b has already been initialised.”
I guess that means this trick can change program behavior, especially if the function containing the static is never called in a program’s execution.