@
coderluan 这个不叫未定义行为啊,应该叫这个 object 具有不确定的值(indeterminate value)
C 语言标准里面没有直接提到这种写法,但是也可以间接地推导出来:
>If an identifier designates two different entities in the same name space, the scopes might overlap. If so, the scope of one entity (the inner scope) will end strictly before the scope of the other entity (the outer scope). Within the inner scope, the identifier designates the entity declared in the inner scope; the entity declared in the outer scope is hidden (and not visible) within the inner scope.
以及:
>If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate.
未定义行为是标准没有描述它会产生什么样的行为(行为不可预测),但是就这个问题而言,标准也是规定了它具有不确定的值(也就是描述了它会产生不确定值的行为)..所以就不是未定义行为....