DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
	dev@dpdk.org, David Marchand <david.marchand@redhat.com>
Subject: Re: [PATCH v1] devtools: allow variable declaration inside for loop
Date: Wed, 3 May 2023 11:23:53 +0100	[thread overview]
Message-ID: <529ef8b3-ec0b-262d-1893-e82bf8016ca5@amd.com> (raw)
In-Reply-To: <ZFIxL7wYtDBH2MEi@bricha3-MOBL.ger.corp.intel.com>

On 5/3/2023 11:02 AM, Bruce Richardson wrote:
> On Wed, May 03, 2023 at 10:50:18AM +0100, Ferruh Yigit wrote:
>> Declaring variable inside for loop is not supported via C89 and it was
>> checked in checkpatch.sh via commit [1].  But as DPDK supported C
>> standard is becoming C99 [2], declaring variable inside loop can be
>> allowed.
>>
>> [1] Commit 43e73483a4b8 ("devtools: forbid variable declaration inside
>> for")
>>
>> [2] https://dpdk.org/patch/121912
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com> --- Cc: Bruce
>> Richardson <bruce.richardson@intel.com> Cc: David Marchand
>> <david.marchand@redhat.com> --- devtools/checkpatches.sh | 8 -------- 1
>> file changed, 8 deletions(-)
>>
> 
> Definite +1 from me for allowing this. However, is the plan still to move
> to C99 in this release. I thought we were just going to jump to C11 in
> 23.11 release? However, I can't see any compilers refusing this if we do
> relax things a bit now.

I will update the commit log for target as C99/C11 .

> 
> I was thinking that our coding standards doc might need an update for this,
> but I don't see the restriction on not doing this documented there, so it
> seems no doc change is necessary.
> 

Commit 43e73483a4b8 refers to following document:

http://doc.dpdk.org/guides/contributing/coding_style.html#local-variables

Which has: "Variables should be declared at the start of a block of code
rather than in the middle."

Although it is comparing between declaring start of a block and middle
of the code, maybe we can update the document to explicitly state that
declaring variable inside for loop is allowed to prevent confusion.

Let me send a new version with documentation update.



  reply	other threads:[~2023-05-03 10:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03  9:50 Ferruh Yigit
2023-05-03 10:02 ` Bruce Richardson
2023-05-03 10:23   ` Ferruh Yigit [this message]
2023-05-03 10:30 ` [PATCH v2] " Ferruh Yigit
2023-05-03 10:57   ` Bruce Richardson
2023-05-03 12:19     ` Morten Brørup
2023-05-03 15:01       ` Thomas Monjalon
2023-05-03 15:06         ` Tyler Retzlaff
2023-07-20  4:05           ` 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=529ef8b3-ec0b-262d-1893-e82bf8016ca5@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.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;
as well as URLs for NNTP newsgroup(s).