[En-Nut-Discussion] Thread-safe version of asctime

Nathan Moore nategoose at gmail.com
Wed May 7 16:17:24 CEST 2014


It is possible to think up scenarios where during an output operation one
thread would rest partway through and another thread would clobber



> > Furthermore I'm not sure about
> >
> > static const char wday_name[][3] = {
> >     "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
> > };
> >
> > AFAIK, sizeof("Sun") is 4, not 3.
>
> Totally true! Thanks! Shall I change it? Or have you just checked in a fix?
>

The format string accounts for this, so it saves a byte for each day of the
week.


More information about the En-Nut-Discussion mailing list