From owner-freebsd-arch@FreeBSD.ORG Fri Nov 14 16:54:38 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 956A216A4CE; Fri, 14 Nov 2003 16:54:38 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80DB343F3F; Fri, 14 Nov 2003 16:54:36 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id LAA25698; Sat, 15 Nov 2003 11:54:34 +1100 Date: Sat, 15 Nov 2003 11:54:33 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "Jacques A. Vidrine" In-Reply-To: <20031114194119.GA94198@madman.celabo.org> Message-ID: <20031115114906.L11453@gamplex.bde.org> References: <20031114194119.GA94198@madman.celabo.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-arch@FreeBSD.org Subject: Re: __TIME_MIN/__TIME_MAX X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Nov 2003 00:54:38 -0000 On Fri, 14 Nov 2003, Jacques A. Vidrine wrote: > In at least one place in libc, it is necessary to range check a time_t > value. One most platforms, time_t has the same range as `int', but > on at least amd64, it has a larger range. Any objections to adding > definitions of __TIME_MIN and __TIME_MAX to sys/${arch}/_limits.h? > > I could just do the usual check for lossage after casting, except that > in theory time_t could be a floating-point value (but not in reality > in FreeBSD). It seems cleaner to me to have an explicit range. I prefer the cast. It doesn't require nonstandard infrastructure that would need to be maintained forever, and works even better for floating point too (assuming a C99 compiler, but not in reality in FreeBSD :) (min/max checks don't work right for floating point because precision may be just as important as range). Bruce