This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Minor doc updates.


On Mon, Jul 29, 2002 at 04:48:45PM -0700, Geoffrey Keating wrote:
>  @item
>  @cite{The definitions for @code{__DATE__} and @code{__TIME__} when
>  respectively, the date and time of translation are not available (6.10.8).}
> +
> +GCC assumes that the date and time is always available.

Hmm...

          time_t tt = time (NULL);
          struct tm *tb = localtime (&tt);

We ought to be checking the return values here.  It is vanishingly
unlikely that time() will fail, but localtime() might not be able to
find its timezone database, and then we'll try to dereference a null
pointer.

"??:??:??" and "??? ?? ????" seem like reasonable failure-mode strings
to return.  Anyone have a better idea?  Know what some other compiler
does in this instance?

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]