Hash :
3aafd550
Author :
Date :
2024-02-10T17:53:34
doc: improve warnings about ctime etc. * doc/posix-functions/asctime.texi (asctime): * doc/posix-functions/asctime_r.texi (asctime_r): Say why these functions are typically used mistakenly. * doc/posix-functions/ctime.texi (ctime): * doc/posix-functions/ctime_r.texi (ctimef): Say that they can dump core due to an internal null pointer, too. * doc/posix-functions/ctime.texi (ctime): Don’t recommend ctime_r.
@node asctime
@section @code{asctime}
@findex asctime
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/asctime.html}
Gnulib module: ---
Portability problems fixed by Gnulib:
@itemize
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
This function is deprecated in C23.
Likewise, POSIX says this function is obsolescent and it is planned to be
removed in a future version.
Portable applications can use @code{strftime} (or even @code{sprintf}) instead.
However, @code{strftime} is locale dependent.
@item
This function may overflow its internal buffer if its argument
specifies a year before 1000 or after 9999.
@xref{ctime}.
@item
Although it is tempting to call this function on the value that
functions like @code{localtime} return, this is typically a mistake.
On most current platforms, these functions return a null pointer for
timestamps out of range, and this function has undefined behavior in
that case.
@end itemize