C++ Logo


Advanced search

Re: [wg14/wg21 liaison] [isocpp-lib-ext] P2264/N2829 make assert() macro user friendly was adopted for C23

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 18 Feb 2022 01:02:24 +0200
On Fri, 18 Feb 2022 at 00:06, Jens Maurer <Jens.Maurer_at_[hidden]> wrote:
> I'm against piecemeal upgrading of C++ to C23 by near-copying
> of normative text from the C23 standard library.
> Since C++ does not show the funny function-like declaration from C
> void assert(scalar expression)
> but instead shows
> #define assert(E) see below
> where it's obvious that embedded commas might not do what you expect,
> I think the "bug fix" argument falls on its face: C++ simply
> has never accepted an arbitrary (phase 7) expression here, but only
> one that is lexically preprocessor-friendly.

Oh, it's certainly not a defect, no. Other than that, I don't see this
quite that way; we have a usability
bug in assert, and Peter has shown us how to fix it,
implementation-technically. In C, it's closer to a defect than it is
in C++, because
C specifices it as-if a function, we don't. Nevertheless, I think it
would be a good idea to fix this bug,
regardless of to what extent and when we sync with C23.

I'm not dying to have the fix, though. It's a common enough problem
that it isn't hard to find the documentation
for how to work around it.

Received on 2022-02-17 23:02:36