Namespaces
Variants
Views
Actions

Talk:c/chrono/ctime

From cppreference.com
< Talk:c‎ | chrono

[edit] undefined behavior

I continue to struggle with "undefined behavior," So, I wish to run the following by you. Compare the description of undefined behavior on this page with the description of undefined behavior on the asctime() page. First, the description on the ctime() appears way down low in the notes, almost as an after thought. On the asctime() page, the description seems to have higher priority by appearing higher on the page. Is there a place where descriptions of undefined behavior should consistently appear on a page? Secondly, the standard says that ctime() is equivalent to asctime(localtime(timer)). I almost want to say that both have the same cases of undefined behavior, but I think that localtime() precludes unnormalized values. On the other hand, the second case of undefined behavior, "more than 4 digits or is less than the year 1000," from the asctime() page seems different from "string longer than 25 characters" from this page. Is the ctime() page saying that year 999 is not a case of undefined behavior? Thirdly, this page uses the phrase "may be undefined," but the asctime() page uses "is undefined." Should this page also use "is?" Newatthis (talk) 08:23, 21 May 2015 (PDT)

it's in Notes here because the behavior, including UB, is already specified in terms of asctime. Year 999 is formally UB, yes, but it's year 10000+ that the hackers use, so it makes sense to stress that possibility as a note. At least that's what I guess, I'm not the editor who wrote the note. --Cubbi (talk) 08:59, 21 May 2015 (PDT)
I remain hopeful that other editors may be able to contribute some background. Newatthis (talk) 04:42, 23 May 2015 (PDT)