[lkml]   [2017]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/1] workqueue: use type int instead of bool to index array
On 2017/9/7 0:40, Tejun Heo wrote:
> 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
> 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 <stdbool.h> 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.
in this case, i think type int is more suitable than bool in aspects of
extendibility, program custom and consistency.

 \ /
  Last update: 2017-09-06 19:08    [W:0.087 / U:35.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site