Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754110AbdIFQkU (ORCPT ); Wed, 6 Sep 2017 12:40:20 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:38116 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751267AbdIFQkT (ORCPT ); Wed, 6 Sep 2017 12:40:19 -0400 X-Google-Smtp-Source: ADKCNb4MNbZxr0jzOoNwKmfqTVMMs/xSiso6IXYxzyu/+anYxCEExBvcTWVvfNsvr4DS6yZzzPEMSg== Date: Wed, 6 Sep 2017 09:40:15 -0700 From: Tejun Heo To: zijun_hu Cc: zijun_hu@htc.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , jiangshanlai@gmail.com Subject: Re: [PATCH 1/1] workqueue: use type int instead of bool to index array Message-ID: <20170906164015.GQ1774378@devbig577.frc2.facebook.com> References: <59AF6CB6.4090609@zoho.com> <20170906143320.GK1774378@devbig577.frc2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1324 Lines: 32 On Thu, Sep 07, 2017 at 12:04:59AM +0800, zijun_hu wrote: > On 2017/9/6 22:33, Tejun Heo wrote: > > Hello, > > > > On Wed, Sep 06, 2017 at 11:34:14AM +0800, zijun_hu wrote: > >> From: zijun_hu > >> > >> type bool is used to index three arrays in alloc_and_link_pwqs() > >> it doesn't look like conventional. > >> > >> it is fixed by using type int to index the relevant arrays. > > > > bool is a uint type which can be either 0 or 1. I don't see what the > > benefit of this patch is.q > > > bool is NOT a uint type now, it is a new type introduced by gcc, it is > rather different with "typedef int bool" historically http://www.open-std.org/jtc1/sc22/wg14/www/docs/n815.htm Because C has existed for so long without a Boolean type, however, the new standard must coexist with the old remedies. Therefore, the type name is taken from the reserved identifier space. To maintain orthogonal promotion rules, the Boolean type is defined as an unsigned integer type capable of representing the values 0 and 1. The more conventional names for the type and its values are then made available only with the inclusion of the header. In addition, the header defines a feature test macro to aid in integrating new code with old code that defines its own Boolean type. -- tejun