From owner-freebsd-standards@FreeBSD.ORG Thu Jan 1 11:26:40 2004 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AB27116A4CE; Thu, 1 Jan 2004 11:26:40 -0800 (PST) Received: from canonware.com (dslh174.fsr.net [12.32.33.174]) by mx1.FreeBSD.org (Postfix) with ESMTP id A6C3F43D39; Thu, 1 Jan 2004 11:26:39 -0800 (PST) (envelope-from jasone@canonware.com) Received: by canonware.com (Postfix, from userid 1001) id 74DE91C8; Thu, 1 Jan 2004 11:27:10 -0800 (PST) Date: Thu, 1 Jan 2004 11:27:10 -0800 From: Jason Evans To: Bruce Evans Message-ID: <20040101192710.GP74719@canonware.com> References: <20040101004057.19C541C5@canonware.com> <20040101153143.N7624@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040101153143.N7624@gamplex.bde.org> User-Agent: Mutt/1.4.1i cc: FreeBSD-gnats-submit@freebsd.org cc: freebsd-standards@freebsd.org Subject: Re: standards/60772: _Bool and bool should be unsigned X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jan 2004 19:26:40 -0000 On Thu, Jan 01, 2004 at 03:52:08PM +1100, Bruce Evans wrote: > The fake definition in FreeBSD-4.9 permits storing values between INT_MIN > and INT_MAX, and changing it to unsigned so that it is limited to values > between 0 and UINT_MAX isn't much of an improvment. You're talking about the following problem, right? { int foo = 42; bool bar; /* This works okay. */ bar = foo ? true : false; /* This breaks on 4.9. */ bar = foo; } This particular problem hasn't bitten me, but you're right that it's a serious problem. > I think the correct fix is to remove in RELENG_4, since it is > impossible to implement it correctly. This sounds reasonable to me, though doing so would potentially prevent quite a number of ports from compiling. Still, it seems better to refuse to compile, than to willingly generate bad binaries. This bug caused a spectacular failure for some code I've been working on, but the resulting bugs could easily have been much more subtle and gone unnoticed. > Was there a defacto standard for it before C99? It doesn't seem to have > been very common -- it isn't in glibc-2.2.5 (which is 2 years old, but > not as old as in FreeBSD). I don't don't think there was a defacto standard for this. The following appears to be the original C99 addition document for stdbool.h: http://std.dkuug.dk/JTC1/SC22/WG14/www/docs/n815.htm Jason From owner-freebsd-standards@FreeBSD.ORG Thu Jan 1 11:30:31 2004 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20D4F16A4CE for ; Thu, 1 Jan 2004 11:30:31 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BEEFF43D45 for ; Thu, 1 Jan 2004 11:30:22 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i01JUMFR076227 for ; Thu, 1 Jan 2004 11:30:22 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i01JUM9N076225; Thu, 1 Jan 2004 11:30:22 -0800 (PST) (envelope-from gnats) Date: Thu, 1 Jan 2004 11:30:22 -0800 (PST) Message-Id: <200401011930.i01JUM9N076225@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Jason Evans Subject: Re: standards/60772: _Bool and bool should be unsigned X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Jason Evans List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jan 2004 19:30:31 -0000 The following reply was made to PR standards/60772; it has been noted by GNATS. From: Jason Evans To: Bruce Evans Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-standards@freebsd.org Subject: Re: standards/60772: _Bool and bool should be unsigned Date: Thu, 1 Jan 2004 11:27:10 -0800 On Thu, Jan 01, 2004 at 03:52:08PM +1100, Bruce Evans wrote: > The fake definition in FreeBSD-4.9 permits storing values between INT_MIN > and INT_MAX, and changing it to unsigned so that it is limited to values > between 0 and UINT_MAX isn't much of an improvment. You're talking about the following problem, right? { int foo = 42; bool bar; /* This works okay. */ bar = foo ? true : false; /* This breaks on 4.9. */ bar = foo; } This particular problem hasn't bitten me, but you're right that it's a serious problem. > I think the correct fix is to remove in RELENG_4, since it is > impossible to implement it correctly. This sounds reasonable to me, though doing so would potentially prevent quite a number of ports from compiling. Still, it seems better to refuse to compile, than to willingly generate bad binaries. This bug caused a spectacular failure for some code I've been working on, but the resulting bugs could easily have been much more subtle and gone unnoticed. > Was there a defacto standard for it before C99? It doesn't seem to have > been very common -- it isn't in glibc-2.2.5 (which is 2 years old, but > not as old as in FreeBSD). I don't don't think there was a defacto standard for this. The following appears to be the original C99 addition document for stdbool.h: http://std.dkuug.dk/JTC1/SC22/WG14/www/docs/n815.htm Jason From owner-freebsd-standards@FreeBSD.ORG Fri Jan 2 13:10:23 2004 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B6CB16A4CE for ; Fri, 2 Jan 2004 13:10:23 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 62B7A43D64 for ; Fri, 2 Jan 2004 13:10:18 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i02LAIFR089443 for ; Fri, 2 Jan 2004 13:10:18 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i02LAI1c089442; Fri, 2 Jan 2004 13:10:18 -0800 (PST) (envelope-from gnats) Date: Fri, 2 Jan 2004 13:10:18 -0800 (PST) Message-Id: <200401022110.i02LAI1c089442@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Jonathan Lennox Subject: Re: standards/60772: _Bool and bool should be unsigned X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Jonathan Lennox List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jan 2004 21:10:23 -0000 The following reply was made to PR standards/60772; it has been noted by GNATS. From: Jonathan Lennox To: freebsd-gnats-submit@FreeBSD.org, jasone@canonware.com Cc: Subject: Re: standards/60772: _Bool and bool should be unsigned Date: Fri, 2 Jan 2004 16:07:15 -0500 Notice also PR bin/48958 -- in RELENG_4, the 'bool' type isn't binary-compatible between C and C++. Another reason to drop it from RELENG_4. -- Jonathan Lennox lennox at cs dot columbia dot edu