From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A93EC4452B for ; Mon, 20 Jul 2026 12:59:45 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64B1740290; Mon, 20 Jul 2026 14:59:44 +0200 (CEST) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id DC3FE4028E for ; Mon, 20 Jul 2026 14:59:42 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id B3E4C20534; Mon, 20 Jul 2026 14:59:42 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH] doc: drop recommendation against bool in structures Date: Mon, 20 Jul 2026 14:59:41 +0200 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65981@smartserver.smartshare.dk> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] doc: drop recommendation against bool in structures X-MimeOLE: Produced By Microsoft Exchange V6.5 Thread-Index: Ad0YR2Cjzh4SHsi7SuqNKUwARQev+gAACffg References: <20260720114602.787429-1-maxime@leroys.fr> <98CBD80474FA8B44BF855DF32C47DC35F65980@smartserver.smartshare.dk> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Bruce Richardson" Cc: "Maxime Leroy" , , "Stephen Hemminger" , "Thomas Monjalon" , "David Marchand" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > From: Bruce Richardson [mailto:bruce.richardson@intel.com] > Sent: Monday, 20 July 2026 14.58 >=20 > On Mon, Jul 20, 2026 at 02:51:09PM +0200, Morten Br=F8rup wrote: > > > From: Bruce Richardson [mailto:bruce.richardson@intel.com] > > > Sent: Monday, 20 July 2026 14.13 > > > > > > On Mon, Jul 20, 2026 at 01:46:02PM +0200, Maxime Leroy wrote: > > > > The coding style advised against bool in structures, citing = space > and > > > > type-size concerns inherited from the Linux kernel. That does = not > > > match > > > > DPDK practice: bool is already used in over 1400 structure = fields > > > across > > > > the tree, including core APIs such as rte_flow. Drop the note so > the > > > > style guide reflects actual usage. > > > > The note is still valid, although massively violated. > > Could we paraphrase the note as an advice/recommendation, instead of > completely removing it? > > The intention is to make developers consider alternatives when = adding > a Boolean field to a structure. > > Maybe it could be expanded with a few example alternatives: > > uint8_t value, or > > uintN_t value:1 (bitfield). > > > I don't think we want those alternative approaches. If something is a > boolean value, then let's just store it as a bool and be done with it. > If > we store it as an int type then we need comments documenting that it's > actually a flag. If it's a bit type, then the field becomes just that > little bit more awkward to manage - though still a good choice if the > struct is size-sensitive. >=20 > Because of this, I'd be in favour of just removing the text and then > letting the developer choose the best field type for the job. If bool > is a > bad choice for a given situation, that should be caught in review. >=20 > /Bruce OK, I'll buy that. Acked-by: Morten Br=F8rup