Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Sep 2004 16:40:45 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Giorgos Keramidas <keramida@freebsd.org>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: bin/71616: [PATCH] cleanup of the usr.sbin/yp_mkdb code
Message-ID:  <20040912234044.GA9417@odin.ac.hmc.edu>
In-Reply-To: <200409122010.i8CKAtIb028207@freefall.freebsd.org>
References:  <200409122010.i8CKAtIb028207@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--BXVAT5kNtrzKuDFl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Sep 12, 2004 at 08:10:55PM +0000, Giorgos Keramidas wrote:
> The following reply was made to PR bin/71616; it has been noted by GNATS.
>=20
> From: Giorgos Keramidas <keramida@freebsd.org>
> To: Dan Lukes <dan@obluda.cz>
> Cc: bug-followup@freebsd.org
> Subject: Re: bin/71616: [PATCH] cleanup of the usr.sbin/yp_mkdb code
> Date: Sun, 12 Sep 2004 21:23:45 +0300
>=20
>  On 2004-09-12 04:37, Dan Lukes <dan@obluda.cz> wrote:
>  > *** usr.sbin/yp_mkdb/yp_mkdb.c.ORIG	Sun Sep  5 18:54:07 2004
>  > --- usr.sbin/yp_mkdb/yp_mkdb.c	Sun Sep  5 19:01:20 2004
>  > [...]
>  > - 	snprintf(buf, sizeof(buf), "%lu", time(NULL));
>  > + 	snprintf(buf, sizeof(buf), "%lu", (long unsigned int)time(NULL));
> =20
>  Just a minor comment: An (unsigned long) cast should be fine here.
> =20
>  There's no need to add `int' and the ordering of long unsigned seems a b=
it
>  backwards -- most of the time I've seen it written with `unsigned' first.

Using unsigned here is actually bogus. time_t is a signed type
in FreeBSD.  SUSv3 says "time_t and clock_t shall be integer or
real-floating types."  In FreeBSD a cast an integer type is safe.
Either long or intmax_t are decent choices today.  I'd generally prefer
intmax_t since that avoids the 2038 bug.  We probably will take time_t
to 64-bits on all platforms at some time in the future so avoiding the
use of longs will save us pain then.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--BXVAT5kNtrzKuDFl
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBRN58XY6L6fI4GtQRAk7cAKDNp+DvpXF8H+LBnXK+aVDJpJcIWgCg4AeI
IhdDyygVNfOASYieU3DzNKc=
=Op+b
-----END PGP SIGNATURE-----

--BXVAT5kNtrzKuDFl--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040912234044.GA9417>