On 2021-10-22 10:13:01 -0700, Kevin J. McCarthy wrote: > On Fri, Oct 22, 2021 at 12:41:39PM +0200, Vincent Lefevre wrote: > > ctime() may be marked obsolescent in the POSIX guide, but it is still > > specified by ISO C, and AFAIK, not marked obsolescent there, even in > > the latest C2x draft N2176. > > I guess POSIX and ISO C should get together and talk then. I had this one > on my todo list for a few years now, after noticing in the man page: > > POSIX.1-2008 marks asctime(), asctime_r(), ctime(), and ctime_r() as > obsolete, recommending the use of strftime(3) instead. > > > Moreover, ISO C says: "It is equivalent to > > > > asctime(localtime(timer))" > > > > So, if you want to replace ctime(), why no using just that? > > asctime() is obsolete too.
They were marked as obsolescent due to a possibility of undefined behavior, but the user can ensure that the behavior is well-defined by checking the argument (a bit like sprintf(), which has not been marked as obsolescent). I've raised the issue in the austin group list. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)