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]
Date: Thu, 11 Jan 2024 14:12:29 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Neal Gompa <neal@...pa.dev>
Cc: "H. Peter Anvin" <hpa@...or.com>, Jason Gunthorpe <jgg@...dia.com>,
	jirislaby@...nel.org, dhowells@...hat.com,
	linux-kernel@...r.kernel.org, pinskia@...il.com,
	kent.overstreet@...ux.dev
Subject: Re: [PATCH 00/45] C++: Convert the kernel to C++

On Thu, Jan 11, 2024 at 05:58:51AM -0500, Neal Gompa wrote:
> On Thu, Jan 11, 2024 at 5:56 AM Alexey Dobriyan <adobriyan@...il.com> wrote:
> >
> > > SFINAE giving inscrutable errors is why I'm saying C++20,
> > > since "concept" means you can get usable error messages.
> >
> > I'd say concepts are irrelevant for the kernel where standard library is
> > tightly controlled by the same people who write rest of the kernel and
> > no external users.
> >
> > static_assert() is all you need.
> 
> We have external users all the time, though. People who write external
> modules or new modules would fall in that classification. Why should
> it be harder for them?

static_assert gives filename:line which clearly points to the source of
an error.

Concepts are SFINAE replacement but if there is little SFINAE there will
be little concepts too.

Another quite silly thing with concepts (and with noexcept propagation)
is that programmer has to write an implementation then chop control flow
and put everything else into the requires. And then to keep both in sync.

This is an example from cppreference:

	template<typename T>
		requires Addable<T>
	T
	add(T a, T b)
	{
		return a + b;
	}

Guess what Addable<> is?

They are kind of nice for simple things:

	template<typename It>
	concept MinimalIterator = requires(It it) { ++it; *it; it++; };

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ