mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Peter Seiderer <ps.report@gmx.net>
Cc: Arnd Bergmann <arnd@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pktgen: avoid unused-const-variable warning
Date: Thu, 27 Feb 2025 15:39:52 +0100	[thread overview]
Message-ID: <5913bf70-de74-4915-9ba1-9cd92dde6945@redhat.com> (raw)
In-Reply-To: <20250227152154.4da61f2f@gmx.net>

On 2/27/25 3:21 PM, Peter Seiderer wrote:
> On Thu, 27 Feb 2025 12:35:45 +0100, Paolo Abeni <pabeni@redhat.com> wrote:
>> I think the unused define is preferable; I think pre-processor defines
>> are cheaper than static const.
> 
> In which regards cheaper (out of interest)?
> 
> Both (with and without static) produce the same code see e.g.
> 
> 	https://godbolt.org/z/Tsr1jM45r
> 	https://godbolt.org/z/6sr1o8da3

I must admit I was unsure the compiler would always optimize out the
constant.

I guess the macro could still produce shorter build time (by a few clock
cycles, nothing measurable ;), so in the end it boils down again to a
personal preference.

Cheers,

Paolo



  reply	other threads:[~2025-02-27 14:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-25  8:57 Arnd Bergmann
2025-02-26 18:17 ` Peter Seiderer
2025-02-27 11:35   ` Paolo Abeni
2025-02-27 14:21     ` Peter Seiderer
2025-02-27 14:39       ` Paolo Abeni [this message]
2025-02-27 12:10 ` patchwork-bot+netdevbpf

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=5913bf70-de74-4915-9ba1-9cd92dde6945@redhat.com \
    --to=pabeni@redhat.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ps.report@gmx.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

all inboxes | Powered by JetHome®