On 11/04/2011 02:37, Jonathan M Davis wrote:
<snip>
I don't know the background of how static variables really work, so is
there a good reason why the first function can't work like the one below
it?

They have to be calculated at compile time so that ordering doesn't matter. If
the order mattered, then you get into dependency problems or risk using
undefined variables. Languages like C++ and Java have problems with that.
<snip>

I recall reading that in C++, static variables are initialised on first call. Which would have to mean that it does something like that internally.

But I might be imagining it.  I'll have to experiment.

Can you give an example of the dependency problems this might lead to?

Stewart.

Reply via email to