C++ Logo

liaison

Advanced search

Re: [isocpp-wg14/wg21-liaison] WG21 feedback required - N3538

From: Jₑₙₛ Gustedt <jens.gustedt_at_[hidden]>
Date: Mon, 5 May 2025 18:31:25 +0200
Ville,

on Mon, 5 May 2025 17:30:39 +0300 you (Ville Voutilainen via Liaison
<liaison_at_[hidden]>) wrote:

> On Mon, 5 May 2025 at 15:48, Nina Dinka Ranns via Liaison
> <liaison_at_[hidden]> wrote:
> >
> > Hi all,
> >
> > there's a paper targeting WG14 regarding static assertions in
> > expressions.
> > https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3538.pdf
> >
> > The author would appreciate WG21 feedback. I encourage you to take
> > a moment to read the paper and share your thoughts.
>
> Here's two thoughts:
>
> 1) the proposal is that a static_assert results in an int. Why not
> bool?

I think `0` (of type `int`) composes much easier in expressions than
`false` (of type `bool`).

> 2) for C++, the proposal is far less compelling in general, because we
> can already lambda-wrap non-expressions into expressions.

But still, having a lambda just to have a place for doing a
`static_assert`, looks a bit of an overkill, at the same level of what
is described in the paper as C solution with a compound literal of an
auxiliary `struct` type.

But even with a λ, you'd have to make it
compose with whatever expression you want to do in that place where
you use the `static_assert`. So I don't have the impression that
becomes much easier in C++.

Jₑₙₛ

-- 
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA antenne de Strasbourg :::::::::::::::::: Camus ::
:: INRIA PIQ program Strasbourg :::::::::: piq.inria.fr ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Received on 2025-05-05 16:31:29