Closed porky11 closed 8 years ago
On Thu, Sep 01, 2016 at 09:32:25AM -0700, Fabio Krapohl wrote:
I assumed that all intern variables are allocated at compile time and are only accessible from the creating namespace, like the containing function, and auto variables are created at runtime on the stack. but when using an intern variable inside a function, it will be set to it's initial value every time the function is called, so it is not as I expected, that they can be used like static variables in c. what do auto variables mean then?
Thanks for reporting this. Your initial understanding was correct, or at least, that's how it was meant to be operating. The problem was that intern function-scoped variables were being treated as if they had been declared with auto, hence the problem. This has now been fixed.
I assumed that all intern variables are allocated at compile time and are only accessible from the creating namespace, like the containing function, and auto variables are created at runtime on the stack. but when using an intern variable inside a function, it will be set to it's initial value every time the function is called, so it is not as I expected, that they can be used like static variables in c. what do auto variables mean then?