May 18, 2017
6:15 p.m.
On 05/18/2017 10:08 AM, Zefram wrote:
it seems like the kind of thing that would have undefined behaviour, but I looked at the C standard, and on my reading it actually doesn't.
I think you need to look at other parts of the standard. C11 6.3.2.1 paragraph 2 says, "If the lvalue designates an object of automatic storage duration that could have been declared with the register storage class (never had its address taken), and that object is uninitialized (not declared with an initializer and no assignment to it has been performed prior to use), the behavior is undefined." Also see C11 6.2.6.1 paragraph 5 for non-character accesses.