[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230322114041.71df75d1@kernel.org>
Date: Wed, 22 Mar 2023 11:40:41 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Shay Agroskin <shayagr@...zon.com>
Cc: Paolo Abeni <pabeni@...hat.com>,
David Miller <davem@...emloft.net>, <netdev@...r.kernel.org>,
"Woodhouse, David" <dwmw@...zon.com>,
"Machulsky, Zorik" <zorik@...zon.com>,
"Matushevsky, Alexander" <matua@...zon.com>,
Saeed Bshara <saeedb@...zon.com>,
"Wilson, Matt" <msw@...zon.com>,
"Liguori, Anthony" <aliguori@...zon.com>,
"Bshara, Nafea" <nafea@...zon.com>,
"Belgazal, Netanel" <netanel@...zon.com>,
"Saidi, Ali" <alisaidi@...zon.com>,
"Herrenschmidt, Benjamin" <benh@...zon.com>,
"Kiyanovski, Arthur" <akiyano@...zon.com>,
"Dagan, Noam" <ndagan@...zon.com>,
"Arinzon, David" <darinzon@...zon.com>,
"Itzko, Shahar" <itzko@...zon.com>,
"Abboud, Osama" <osamaabb@...zon.com>,
Eric Dumazet <edumazet@...gle.com>,
Vladimir Oltean <vladimir.oltean@....com>,
Andrew Lunn <andrew@...n.ch>,
Guangbin Huang <huangguangbin2@...wei.com>,
Jie Wang <wangjie125@...wei.com>,
Johannes Berg <johannes@...solutions.net>,
Edward Cree <ecree.xilinx@...il.com>,
Florian Westphal <fw@...len.de>
Subject: Re: [PATCH v6 net-next 1/7] netlink: Add a macro to set policy
message with format string
On Wed, 22 Mar 2023 14:39:49 +0200 Shay Agroskin wrote:
> > You should use '__extack' even above, to avoid multiple
> > evaluation of
> > the 'extack' expression.
>
> I've got to admit that I don't understand the cost of such
> evaluations. I thought that it was added to help readers of the
> source code to understand what is the type of this attribute and
> have a better warning message when the wrong variable is passed
> (kind of typing in Python which isn't strictly needed).
> What cost is there for casting a pointer ?
It's not about the cost, the macros are unfolded by the preprocessor,
in the unlikely case someone passes extack++ as an argument using it
twice inside the body of the macro will increment the value twice.
#define MACRO(arg) function_bla(arg, arg) // use arg twice
int a = 1;
MACRO(a++);
print(a); // should print 2, will print 3
Powered by blists - more mailing lists