:
++ 98 ++ 03:
3.6.2 , §1:
(3.7.1) (8.5), .
3.7.1 , §1:
, , .
3.7.1 , §3:
static .
8.5 , §6:
.
. ++ 98 8.5 §6:
, , .
:
, x y , , . , POD a b, , , , (i d) :
struct POD {
int i;
double d;
};
int x;
POD a;
int foo() {
static int y;
return y;
}
int main() {
static POD b;
std::cout << "x = " << x << std::endl;
std::cout << "y = " << foo() << std::endl;
std::cout << "a.i = " << a.i << std::endl;
std::cout << "b.d = " << b.d << std::endl;
}
, , :
x = 0
y = 0
a.i = 0
b.d = 0