Why is a static struct's dtor called at the exit of a function?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Fri Jul 22 23:52:28 PDT 2011
What are the current semantics of static struct definitions in module
scope? It doesn't seem to have any effect. I was thinking about this:
module test;
int z;
static struct Foo
{
void foo()
{
z = 5; // maybe make this an error if the struct definition is static?
}
}
Maybe it could be useful as protection against modifying globals.
More information about the Digitalmars-d-learn
mailing list