From: Stephen Hemminger <stephen@networkplumber.org>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: <dev@dpdk.org>, <fengchengwen@huawei.com>
Subject: Re: [PATCH v2] test/argparse: change initialization to workaround LTO
Date: Mon, 30 Jun 2025 08:23:16 -0700 [thread overview]
Message-ID: <20250630082316.689de55a@hermes.local> (raw)
In-Reply-To: <aGKrNT8h5FGVrBjH@bricha3-mobl1.ger.corp.intel.com>
On Mon, 30 Jun 2025 16:20:21 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:
> We should consider either making this a "do { } while" loop or adding the
> termination condition to the "for" loop statement as normal. For example:
>
> unsigned int i = 0;
>
> obj = backup;
> do {
> obj.args[i] = backup.args[i];
> } while (backup.args[++i].name_long != NULL);
>
> or else:
>
> obj = backup;
> for (i = 0; backup.args[i].name_long != NULL; i++)
> obj.args[i] = backup.args[i];
> obj.args[i] = ARGPARSE_ARG_END();
>
> I'd tend toward the second, myself, but what is in your patch above is fine
> as-is too.
Agree with one of the two is more readable.
I kind of wanted to keep what original code was doing.
next prev parent reply other threads:[~2025-06-30 15:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 16:22 [PATCH] test/argparse: fix out of bound memcpy Stephen Hemminger
2025-06-27 18:56 ` Bruce Richardson
2025-06-30 14:57 ` Stephen Hemminger
2025-06-30 14:58 ` [PATCH v2] test/argparse: change initialization to workaround LTO Stephen Hemminger
2025-06-30 15:20 ` Bruce Richardson
2025-06-30 15:23 ` Stephen Hemminger [this message]
2025-06-30 15:24 ` Stephen Hemminger
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=20250630082316.689de55a@hermes.local \
--to=stephen@networkplumber.org \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).