staticforward and C++
Isaac To Kar Keung
kkto at csis.hku.hk
Thu May 24 01:06:46 EDT 2001
>>>>> "Greg" == Greg Ewing <see at my.signature> writes:
Greg> From a brief experiment, it appears that g++ complains about it
Greg> either way!
Greg> However, I found that the following *does* work:
Greg> struct Foo { int x; };
Greg> void f() { extern Foo foo; foo.x = 42; }
Greg> static Foo foo;
And also the following:
namespace {
struct Foo { int x; };
extern Foo foo;
}
void f() {
foo.x = 42;
}
namespace {
Foo foo;
}
I believe that this would be the reaction from C++ supporters: the use of
"static" to achieve anonymity is explicitly deprecated in C++.
Regards,
Isaac.
More information about the Python-list
mailing list