From patchwork Tue Jan 8 19:56:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: York Sun X-Patchwork-Id: 210488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D5E782C00A4 for ; Wed, 9 Jan 2013 06:56:34 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4D9A74A143; Tue, 8 Jan 2013 20:56:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d68eRD9UEpZw; Tue, 8 Jan 2013 20:56:32 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7BC2E4A146; Tue, 8 Jan 2013 20:56:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 513654A146 for ; Tue, 8 Jan 2013 20:56:30 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lhwERF35CaFK for ; Tue, 8 Jan 2013 20:56:29 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from va3outboundpool.messaging.microsoft.com (va3ehsobe002.messaging.microsoft.com [216.32.180.12]) by theia.denx.de (Postfix) with ESMTPS id 3C2964A143 for ; Tue, 8 Jan 2013 20:56:28 +0100 (CET) Received: from mail173-va3-R.bigfish.com (10.7.14.237) by VA3EHSOBE002.bigfish.com (10.7.40.22) with Microsoft SMTP Server id 14.1.225.23; Tue, 8 Jan 2013 19:56:26 +0000 Received: from mail173-va3 (localhost [127.0.0.1]) by mail173-va3-R.bigfish.com (Postfix) with ESMTP id AC8DFC0105; Tue, 8 Jan 2013 19:56:26 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: -4 X-BigFish: VS-4(zzbb2dI98dI9371I1432Izz1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839h93fhd25he5bhf0ah1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh162dh1631h1758h1765h1155h) Received: from mail173-va3 (localhost.localdomain [127.0.0.1]) by mail173-va3 (MessageSwitch) id 1357674982165450_12170; Tue, 8 Jan 2013 19:56:22 +0000 (UTC) Received: from VA3EHSMHS022.bigfish.com (unknown [10.7.14.235]) by mail173-va3.bigfish.com (Postfix) with ESMTP id B089B16011F; Tue, 8 Jan 2013 19:56:21 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS022.bigfish.com (10.7.99.32) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 8 Jan 2013 19:56:20 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.2.318.3; Tue, 8 Jan 2013 19:56:19 +0000 Received: from [10.214.85.168] ([10.214.85.168]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r08JuH1e028096; Tue, 8 Jan 2013 12:56:18 -0700 Message-ID: <50EC79E1.1080802@freescale.com> Date: Tue, 8 Jan 2013 11:56:17 -0800 From: York Sun User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Wolfgang Denk References: <1357596628-27501-1-git-send-email-yorksun@freescale.com> <20130107223942.94BED20DA7E@gemini.denx.de> <6AE080B68D46FC4BA2D2769E68D765B70820541F@039-SN2MPN1-023.039d.mgd.msft.net> <20130108174920.BAB22202B69@gemini.denx.de> <50EC5D29.1070408@freescale.com> <20130108190715.D2D14202B69@gemini.denx.de> In-Reply-To: <20130108190715.D2D14202B69@gemini.denx.de> X-OriginatorOrg: freescale.com Cc: Wood Scott-B07421 , Timur Tabi , Fleming Andy-AFLEMING , "u-boot@lists.denx.de" Subject: Re: [U-Boot] [PATCH] Introduce a global bool type X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de On 01/08/2013 11:07 AM, Wolfgang Denk wrote: > Dear Timur Tabi, > > In message <50EC5D29.1070408@freescale.com> you wrote: >> >>> _Bool has been introduced very late to any C standard, and you can >>> still see this from the ugly, unnatural name. >> >> It was introduced in C99, which is over 12 years old. > > And how old is C? I think the "official" announcment was 1972, so > that's more than twice as long without that addition. > >>> work wit than a CLI. And I've seen more than one case where bugs were >>> caused by using "proper bool types" like this: >>> >>> i = 0; >>> j = 0; >>> k = 2; >>> >>> if ((i | j | k) == true) ... >> >> Ok, but this is just wrong. i, j, and k are not boolean types, so they >> should not be compared with 'true' or 'false'. I don't think you'll find >> any disagreement with that. > > You are right. And I wrote that it's a bug. But this is what you can > easily get from using boolean types. This is example has not been > invented by me. I don't even claim that this was good programming > style - all I want to say is that from what I have seen the boolean > types are not a panacea; they cause new problems as well. > No disagree. How shall we close this? Will some change like below acceptable? York diff --git a/include/linux/types.h b/include/linux/types.h index 925ece7..f07ba41 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -7,6 +7,7 @@ #include #include +#include #ifndef __KERNEL_STRICT_NAMES @@ -113,10 +114,6 @@ typedef __u64 u_int64_t; typedef __s64 int64_t; #endif -typedef _Bool bool; -#define false 0 -#define true 1 - #endif /* __KERNEL_STRICT_NAMES */ /*