[tz] proposed changes for Win32 and a improved mktime() algorithm

Zefram zefram at fysh.org
Thu May 18 19:07:21 UTC 2017


Ian Abbott wrote:
>I'm not sure about that.  Although it is not normative, Section "J.2
>Undefined behavior" includes:
>
>#  - The value of an object with automatic storage duration is
>#    used while it is indeterminate (6.2.4, 6.7.9, 6.8).

Interesting.  This exists in both C99 and C11.  However, the list item
is not supported by the normative sections of the standard to which it
refers, in either version.

The first referenced section, 6.2.4, in paragraph 2, makes the narrower
statement that "if an object is referred to outside of its lifetime,
the behaviour is undefined".  It also states that the lifetime of an
auto variable (other than a variable length array) starts at the start
of its enclosing block.  Neither of the other referenced sections, or all
three taken together, say anything closer to what the list item claims.

So I think the list item is actually erroneous.  It might possibly have
be intended to refer to the lifetime rule in 6.2.4, but that appears as
another list item in J.2.  Perhaps it referred to other wording in an
earlier draft of C99 that later got edited out.

As Paul Eggert has pointed out in another message, C11 section 6.3.2.1 has
wording that makes the situation described by the list item *usually*
undefined behaviour.  C99 doesn't have it.  Since the wording of
the list item didn't change between versions (except for updating a
section number), the fact that the item is now nearly correct seems to
be accidental.

-zefram


More information about the tz mailing list