public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH v5 1/2] Y2038: Add 64-bit time for all architectures
Date: Tue, 19 Jun 2018 23:25:00 -0000	[thread overview]
Message-ID: <7c019928-a664-dc58-b143-5b76f9ca0b44@cs.ucla.edu> (raw)
In-Reply-To: <20180618191443.9926-2-albert.aribaud@3adev.fr>

On 06/18/2018 12:14 PM, Albert ARIBAUD (3ADEV) wrote:
> +/* Check whether a time64_t value fits in a time_t.  */
> +static inline bool
> +fits_in_time_t (__time64_t t)
> +{
> +  return t == (time_t) t;
> +}

This static function is used nowhere in this patch series. Shouldn't its 
introduction be delayed to the first patch that actually needs it?

Also, looking at the two future uses of this function, they're both of 
the form:

   __time64_t t64 = [something];
   if (fits_in_time_t (t64))
     return (time_t) t64;
   __set_errno (EOVERFLOW);
   return -1;

Wouldn't it be better to have these uses do the following instead? This 
would be just as clear, and would avoid the need for casts and for the 
fits_in_time_t function.

   __time64_t t64 = [something];
   time_t t = t64;
   if (t == t64)
     return t;
   __set_errno (EOVERFLOW);
   return -1;

  reply	other threads:[~2018-06-19 23:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 19:14 [PATCH v5 0/2] Y2038 support batch 1 - __time64_t and __tz_convert Albert ARIBAUD (3ADEV)
2018-06-18 19:14 ` [PATCH v5 2/2] Y2038: make __tz_convert compatible with 64-bit-time Albert ARIBAUD (3ADEV)
2018-06-19 23:35   ` Paul Eggert
2018-06-20  6:06     ` Albert ARIBAUD
2018-06-18 19:14 ` [PATCH v5 1/2] Y2038: Add 64-bit time for all architectures Albert ARIBAUD (3ADEV)
2018-06-19 23:25   ` Paul Eggert [this message]
2018-06-20  6:04     ` Albert ARIBAUD
2018-06-20  6:29       ` Albert ARIBAUD
2018-06-20  7:16       ` Albert ARIBAUD
2018-06-20 16:01       ` Paul Eggert
2018-06-20 16:46         ` Albert ARIBAUD
2018-06-20 17:50           ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c019928-a664-dc58-b143-5b76f9ca0b44@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=albert.aribaud@3adev.fr \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).