Date: Wed, 7 May 2025 10:43:40 +0200
Jens,
on Tue, 6 May 2025 17:10:15 +0200 you (Jens Maurer
<jens.maurer_at_[hidden]>) wrote:
> Yes, those are the current C rules. I suggest that WG14 relax the
> rules in 6.6 p3 about which operators may appear inside a
> constant-expression, permitting ((void)1, 1) to be an integer
> constant expression.
That would not only be about the comma operator, then, but also about
void expressions, which are currently not allowed in CE, either.
> > But at the end, my point it that if static_assert() yields an
> > integer, it can be used with both the comma operator and with other
> > operator (such as the +, c.f. prior works). So, yielding an integer
> > does not close any doors.
>
> I think having to write something like
>
> ( static_assert(x > 0) + static_assert(x < 99) + x + 3 )
>
> is visually inferior to writing
>
> ( static_assert(x > 0), static_assert(x < 99), x + 3 )
>
> In the former case, there is no actual sum of four numbers being
> computed; there are two static assertions plus a sum of two numbers.
Agreed.
Jₑₙₛ
on Tue, 6 May 2025 17:10:15 +0200 you (Jens Maurer
<jens.maurer_at_[hidden]>) wrote:
> Yes, those are the current C rules. I suggest that WG14 relax the
> rules in 6.6 p3 about which operators may appear inside a
> constant-expression, permitting ((void)1, 1) to be an integer
> constant expression.
That would not only be about the comma operator, then, but also about
void expressions, which are currently not allowed in CE, either.
> > But at the end, my point it that if static_assert() yields an
> > integer, it can be used with both the comma operator and with other
> > operator (such as the +, c.f. prior works). So, yielding an integer
> > does not close any doors.
>
> I think having to write something like
>
> ( static_assert(x > 0) + static_assert(x < 99) + x + 3 )
>
> is visually inferior to writing
>
> ( static_assert(x > 0), static_assert(x < 99), x + 3 )
>
> In the former case, there is no actual sum of four numbers being
> computed; there are two static assertions plus a sum of two numbers.
Agreed.
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-07 08:43:46