- 论坛徽章:
- 2
|
与C标准无关
beepbug 发表于 2010-07-31 17:41 ![]()
c99 6.7.8-10
If an object that has automatic storage duration is not initialized explicitly, its value is
indeterminate. If an object that has static storage duration is not initialized explicitly,
then:
— if it has pointer type, it is initialized to a null pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned) zero;
— if it is an aggregate, every member is initialized (recursively) according to these rules;
— if it is a union, the first named member is initialized (recursively) according to these rules.
c89 6.5.7
If an object that has automatic storage duration is not initialized explicitly. its value is
indetelminate.74) If an object that has static storage duration is not initialized explicitly. it is
initialized implicitly as if every member that has arithmetic type were assigned 0 and every
member that has pointer type were assigned a null pointer constant.
74 Unlike in the base document. any automatic duration object may be initialized |
|