> The fact that it may not have been explicitly initialized does not affect the correctness of the code; there's no undefined behaviour being invoked here.
Please consult the relevant sections of the C standard. To be specific, see e.g. C99, 6.2.4.5: "The initial value of the object is indeterminate". Then, the definition of indeterminate at 3.17.2: "either an unspecified value or a trap representation". Subsequently, in J.2: "The behavior is undefined in the following circumstances: […] a trap representation is read by an lvalue expression that does not have character type." Reading uninitialized memory is just as undefined as reading from unallocated areas. There IS absolutely UB being invoked, and this fact does not change based on your definition of "invalid". Sent from my iPhone