本帖最后由 john_lee 于 2011-3-18 13:22 编辑
肯定会的,这是C99标准规定的。C99原文摘录:
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.
翻译:
如果一个具有自动存储持续时间(生命期)的对象不显式初始化,它的(初始)值是不确定的。如果一个具有静态存储持续时间(生命期)的对象不显式初始化,那么:
- 如果它有指针类型,它是初始化为空指针;
- 如果它有算术类型,它被初始化为(正或无符号)零;
- 如果它是一个聚合(结构),每一个成员根据本规则被(递归地)初始化;
- 如果它是一个联合,第一个命名的成员根据本规则被(递归地)初始化。 |