T
Triple-DES
I've seen this question raised more than once, but I have not yet seen
a definite, conclusive answer. Consider the following code:
struct C {
C() {} // might throw
};
int main() {
try {
static C c;
}
catch(...) {
//...
}
}
Now according to 6.7/4:
"(...) An implementation is permitted to perform early initialization
of other local objects with static storage duration under the same
conditions that an implementation is permitted to statically
initialize an object with static storage duration in namespace scope
(3.6.2).(...)"
Are the following statements correct?
1)
An implementation may perform early initialization of c, possibly
resulting in an uncaught exception.
2)
Early initialization can be prevented by making C::C() modify an
arbitrary object of namespace scope with static storage duration, per
3.6.2/2
Thanks in advance.
DP
a definite, conclusive answer. Consider the following code:
struct C {
C() {} // might throw
};
int main() {
try {
static C c;
}
catch(...) {
//...
}
}
Now according to 6.7/4:
"(...) An implementation is permitted to perform early initialization
of other local objects with static storage duration under the same
conditions that an implementation is permitted to statically
initialize an object with static storage duration in namespace scope
(3.6.2).(...)"
Are the following statements correct?
1)
An implementation may perform early initialization of c, possibly
resulting in an uncaught exception.
2)
Early initialization can be prevented by making C::C() modify an
arbitrary object of namespace scope with static storage duration, per
3.6.2/2
Thanks in advance.
DP