bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module suggestion: fprintftime-check


From: Paul Eggert
Subject: Re: new module suggestion: fprintftime-check
Date: Sat, 29 Dec 2018 09:22:17 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

I suspect that changing this behavior would be a disruptive
backwards-incompatible change (but other opinions are welcomed).

I wouldn't mind a change as long as it changes the API enough so that compilers complain if we don't also update the calling code. For example, nstrftime could take an additional ptrdiff_t * argument that (if not null) is set to the offset of the first offending % or encoding error, or to -1 if the format is OK. (We should report encoding errors as well as bad % formats.)

(Using ptrdiff_t is part of my campaign to prefer ptrdiff_t to size_t. While we're at it, let's change the other size_t args to ptrdiff_t, but I digress....)

nstrtime's __strftime_internal() is a complicated beast, I don't
claim to fully understand it.
But the function contains this comment:
    /* POSIX.1 requires that local time zone information be used as
      though strftime called tzset.  */
https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/nstrftime.c#n540

This comment is for the POSIX API where there was no timezone_t argument. It doesn't apply to the Gnulib API, because of the "undef HAVE_TZSET" earlier on. The only reason for the tzset_called stuff is the faint hope that we can merge all this stuff into glibc someday.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]