From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59121 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OlRdj-0003RF-HJ for qemu-devel@nongnu.org; Tue, 17 Aug 2010 15:16:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OlRdi-0007wl-30 for qemu-devel@nongnu.org; Tue, 17 Aug 2010 15:16:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38431) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OlRdh-0007wd-SL for qemu-devel@nongnu.org; Tue, 17 Aug 2010 15:16:02 -0400 Message-ID: <4C6ADFED.5020703@redhat.com> Date: Tue, 17 Aug 2010 21:15:57 +0200 From: Jes Sorensen MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 2/5] CODING_STYLE: add C type rules References: <4C6A43B5.40809@redhat.com> <4C6AD744.1070009@twiddle.net> In-Reply-To: <4C6AD744.1070009@twiddle.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Blue Swirl , qemu-devel On 08/17/10 20:39, Richard Henderson wrote: > On 08/17/2010 01:09 AM, Jes Sorensen wrote: >> On 08/12/10 19:50, Blue Swirl wrote: >>> +While using "bool" is good for readability, it comes with minor caveats: >>> + - Don't use "bool" in places where the type size must be constant across >>> + all systems, like public interfaces and on-the-wire protocols. >>> + - Don't compare a bool variable against the literal, "true", >>> + since a value with a logical non-false value need not be "1". >>> + I.e., don't write "if (seen == true) ...". Rather, write "if (seen)...". >> >> I'd strongly discourage the use of bool in any code. > > I strongly disagree. The use of "bool", even if you ignore stdbool.h > and do "typedef int bool", is valuable documentation in the code. I guess we have to agree to disagree then. IMHO it just masks the real type and you end up with cases where people pass it back and forth randomly. Cheers, Jes