lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiQr8U7nCnUci3_20vKyU2cx0BQ7HRNqxsHm+EP-6PCPQ@mail.gmail.com>
Date: Wed, 24 Jul 2024 12:48:52 -0700
From: Linus Torvalds <torvalds@...uxfoundation.org>
To: David Laight <David.Laight@...lab.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, 
	"Matthew Wilcox (Oracle)" <willy@...radead.org>, Christoph Hellwig <hch@...radead.org>, 
	Andrew Morton <akpm@...ux-foundation.org>, 
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, 
	Dan Carpenter <dan.carpenter@...aro.org>, Arnd Bergmann <arnd@...nel.org>, 
	"Jason@...c4.com" <Jason@...c4.com>, "pedro.falcato@...il.com" <pedro.falcato@...il.com>, 
	Mateusz Guzik <mjguzik@...il.com>, "linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: Re: [PATCH 3/7] compiler.h: Add __if_constexpr(expr, if_const, if_not_const)

On Wed, 24 Jul 2024 at 07:30, David Laight <David.Laight@...lab.com> wrote:
>
> Implemented using _Generic() for portibility.

I do think this is ultimately the clearer implementation, if only
because the underlying trick it uses does very much depend on a very
special oddity in the C type system.

So then using the type comparison with _Generic() is rather natural,
and allows for picking other things than 0/1 as a result.

However, there is NO WAY this is a "portability" enhancement.

The original trick basically works on all ANSI C versions, while
"_Generic()" is quite a modern thing (added in C11? Something like
that)

Now, in the kernel we obviously already moved to -std=gnu11 a couple
of years ago, so doing this looks reasonable.

But what does not look reasonable to me is claiming that it's a
portability thing. Quite the opposite. It still requires the same
ternary operator type trick, now it just requires _Generic() support
in _addition_ to it.

              Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ