DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Bruce Richardson" <bruce.richardson@intel.com>
Cc: "Maxime Leroy" <maxime@leroys.fr>, <dev@dpdk.org>,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	"Thomas Monjalon" <thomas@monjalon.net>,
	"David Marchand" <david.marchand@redhat.com>
Subject: RE: [PATCH] doc: drop recommendation against bool in structures
Date: Mon, 20 Jul 2026 14:59:41 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65981@smartserver.smartshare.dk> (raw)
In-Reply-To: <al4bRFcOPwqXGPhM@bricha3-mobl1.ger.corp.intel.com>

> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Monday, 20 July 2026 14.58
> 
> On Mon, Jul 20, 2026 at 02:51:09PM +0200, Morten Brørup 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.
> 
> 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.
> 
> /Bruce

OK, I'll buy that.

Acked-by: Morten Brørup <mb@smartsharesystems.com>


  reply	other threads:[~2026-07-20 12:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 11:46 [PATCH] doc: drop recommendation against bool in structures Maxime Leroy
2026-07-20 12:13 ` Bruce Richardson
2026-07-20 12:51   ` Morten Brørup
2026-07-20 12:57     ` Bruce Richardson
2026-07-20 12:59       ` Morten Brørup [this message]
2026-07-21 13:17 ` Marat Khalili
2026-07-22  9:44 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35F65981@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=maxime@leroys.fr \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox